文本:宽度不适合如果你看看下面的jsfiddle具有多inline-block的元素
<div class="box">
<h1>This heading</h1>
<h1>This is one heading</h1>
</div>
.box {
width: 350px;
}
h1 {
display: inline-block;
background: url('http://networkmotion.rnmcloud.com/wp-content/themes/networkmotion/images/blue_arrows.png') no-repeat right top;
padding-right: 100px;
}
正如你所看到的第一个标题的宽度是文本的宽度和背景图片在文本之后很好地放置。在第二个标题中,虽然标题的宽度不符合文本的宽度,所以背景图像向右浮动。
如何使标题的宽度始终缩小至尽可能小,以便背景图像总是接近文本?