リンクの背景のスタイルを設定する必要があります。幅が異なるため、2 つの画像を使用する必要があるため、リンク内にスパンがあります。
リンクを左にフロートさせる必要もありました。つまり、両方をクリアするように段落を設定する必要があります。
私のソリューションは機能しますが、多くの css と余分な html 要素を追加しているようです。よりエレガントなソリューションはありますか?
<p>Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text </p>
<a href="#" class="my-link"><span> This is a link sdafsdafsdaf </span>
</a>
<p>Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text Here is some text </p>
a {
background: url("http://smartpeopletalkfast.co.uk/body-link-bg.jpg") 100% 50%;
line-height: 50px;
float: left;
}
a span {
background: url("http://smartpeopletalkfast.co.uk/body-link-bg-2.jpg") no-repeat;
height: 49px;
display: block;
padding-left: 20px;
padding-right: 40px;
}
p {
clear: both;
}