Bootstrap 使用图像而不是字形

Bootstrap using image indead of glyphicon

是否可以在bootstrap-min.css

中使用图片

我们正在使用主题(现代),一些图标由 bootstrap 控制。

我想更改以下行以使用图像。

.glyphicon-home:before{content:"\e021"}

试试这个:

.glyphicon-home{
    display:inline-block;
    background-image:url('../images/YOUR_IMAGE.png');
    width:20px;
    height:20px;
}

只需清除内容参数并使用背景添加您自己的图像。其余样式 (display:inline-block) 仍应继承。

.glyphicon-home:before{
    content: "";
    background: url(IMAGEPATH) 50% 50% no-repeat;
}

哦 - 我不会把它放入 bootstrap.min.css - 将它添加到稍后调用的样式表,或者你的主题 style.css