我有一個圖像,我必須用於我的標題,我不能使用固定圖像作爲標題寬度根據標題文本而變化,因此我做了3片圖像,重複,中間片將重複與文本和結束切片圖像,應該關閉標題,我已經包括了圖像和我正在使用的CSS,結束切片不起作用,任何人都可以告訴我我做錯了什麼:爲標題使用背景圖像
<div class="product-item">
<div class="product-title">
<span><h3>@Model.Name</h3></span>
</div>
</div>
CSS:
.product-grid .product-item .product-title
{
background-image: url('images/first-slice.png');
background-repeat: no-repeat;
background-position: 0% 0%;
height:37px;
}
.product-grid .product-item .product-title span
{
background-image: url('images/last-slice.png');
background-repeat: no-repeat;
background-position: 100% 50%;
height:37px;
}
.product-grid .product-item .product-title h3
{
background-position: 50%;
background-image: url('images/middle-slice.png');
background-repeat: repeat-x;
height:37px;
margin-left:5px;
}
現場測試網站:Website
首先圖片: 中圖片: 結束切片:
我只想補充的高端形象,ü意味着應該增加而不是跨度有點像另一個類:
...
的風格,雖然它的語義上不正確的有一個跨度H3,這是這個問題的不是原因 - H3的高度,使得跨接管37px高度 – ptriek
所以正確的方法是將包一切的div然後添加造型 –