文本:寬度不適合如果你看看下面的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;
}
正如你所看到的第一個標題的寬度是文本的寬度和背景圖片在文本之後很好地放置。在第二個標題中,雖然標題的寬度不符合文本的寬度,所以背景圖像向右浮動。
如何使標題的寬度始終縮小至儘可能小,以便背景圖像總是接近文本?