<div class="cn_header">
<div class="print"></div>
example
</div>
.cn_header{
background: #C2E1FF;
height: 24px;
line-height: 24px;
padding: 5px;
}
.print{
background: url(http://mcgrefer.com/images/search.png);
display: inline-block;
height: 24px;
width: 24px;
}
http://jsfiddle.net/Luntegg/2SCvf/1/
如何使用背景图像和文本设置内联div?
答案 0 :(得分:2)
答案 1 :(得分:0)
将文字放在div中:
<div class="cn_header">
<div class="print">example</div>
</div>
.cn_header{
background: #C2E1FF;
height: 24px;
line-height: 24px;
padding: 5px;
}
.print{
background-image: url(http://mcgrefer.com/images/search.png);
display: inline-block;
height: 24px;
width: 24px;
padding-left: 30px; /* This */
background-repeat: no-repeat; /* And This One */
}