【问题标题】:Can any one tell where i went wrong in applying CSS谁能告诉我在应用 CSS 时哪里出错了
【发布时间】:2012-01-07 15:15:02
【问题描述】:

我为图片按钮应用了css,如下所示

<style type="text/css">
    .selected
    {
        padding-left:50px;
        background: transparent url('Images/samplecopy.jpg') ;
        background-repeat: repeat;
    }
</style>

&lt;asp:ImageButton ID="btnYes" CssClass="selected" runat="server" ImageUrl="~/Images/image.jpg" /&gt;

但我没有按要求获得。我想用应用的背景图片覆盖整个image button

我需要将黑色背景完全悬停在图像上,任何人都可以帮助我

【问题讨论】:

    标签: c# asp.net css


    【解决方案1】:

    不要使用填充,这是导致问题的原因。

    使用下面的代码,看看是否有帮助

    <style type="text/css">
    .selected
    {
        padding:0px;
        background: transparent url('Images/samplecopy.jpg') ;
        background-repeat: repeat;
    }
    </style>
    

    更新

    clear: both;
    padding: 5px;
    border: 1px;
    background: transparent url('Images/samplecopy.jpg') ;
    background-repeat: repeat;
    color: #FFF;
    font-weight: bold;
    font-size: 12px;
    border-radius:3px;
    

    在 CSS 中尝试这些属性并告诉我是否有帮助。

    【讨论】:

    • 但我无法应用我需要的背景颜色
    • 我想在那个图像按钮上显示背景颜色图像
    • 我已经更新了答案。试试这个,让我知道,如果这是你想要的
    • 是的,如果我需要将它完全应用到图像上,我应该怎么做
    • 我已经更新了代码以使用您的图像...希望它可以使事情正常进行
    猜你喜欢
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    • 2010-11-30
    相关资源
    最近更新 更多