【问题标题】:How to add custom image background to span inside bootstrap button?如何添加自定义图像背景以跨越引导按钮?
【发布时间】:2015-09-10 04:00:41
【问题描述】:

我想使用自定义图标作为跨度内的背景图像作为引导切换按钮。不使用 fontawesome 或 glyphicons 是否可以实现它?

CSS:

.icon-search {
    background-image: url("https://dl.dropboxusercontent.com/u/23295105/search.png");
    background-repeat: no-repeat;
    background-position: center center;
}

HTML:

<button class="toggle">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-search"></span>
</button>

这是我的小提琴: http://jsfiddle.net/ox04anfb/

【问题讨论】:

    标签: html css twitter-bootstrap-3


    【解决方案1】:

    将此添加到您的 css 中

    width: 20px; // replace with actual width
    height: 20px; // replace with actual height
    display: inline-block;
    

    【讨论】:

      【解决方案2】:

      尝试 QED 的解决方案,但添加 auto 属性:

      width: auto; // replace with actual width
      height: auto; // replace with actual height
      display: inline-block;
      

      【讨论】:

        猜你喜欢
        • 2013-12-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-01
        • 1970-01-01
        相关资源
        最近更新 更多