【问题标题】:Can't add image to text on Bootstrap button无法在 Bootstrap 按钮上将图像添加到文本
【发布时间】:2012-08-28 19:03:52
【问题描述】:

我正在使用 Bootstrap,有时很难覆盖它。

我想在我的按钮上添加一些图片,靠近文本。所以我添加了背景图像,但它不适用。

这是我的按钮的 css:

 .submit .report{
font-size: 18px;
text-shadow: none;
font-weight: bold;
padding: 5px;
width:300px;
color:white;
filter:alpha(opacity=100);
background: #628d28;
background-image:url('../images/picture.png') no-repeat;
}

但 Firebug 说,我的元素有下一个 CSS:

  .submit .report{
font-size: 18px;
text-shadow: none;
font-weight: bold;
padding: 5px;
width:300px;
color:white;
filter:alpha(opacity=100);
background-image: none repeat color(98,141,40);

}

为什么我不能添加背景图片?

【问题讨论】:

    标签: html css twitter-bootstrap


    【解决方案1】:

    您定义了错误的背景属性。像这样写:

    .submit .report{
    background-color: #628d28;
    background-image:url('../images/picture.png');
    background-repeat:no-repeat;
    }
    

    .submit .report{
        background: #628d28 url('../images/picture.png') no-repeat;
     }
    

    【讨论】:

    • 嗨.. 如果我写 no-repeat 我看不到图像,如果我不写 no-repeat 然后我看到多个图像作为背景。
    • .icon-flight { background-image: url('../img/flight.png') ;背景位置:中心中心; }
    猜你喜欢
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    • 2020-08-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多