2012-04-16 25 views
0

我們嘗試使用單個圖像作爲下邊框失敗。看看我們在這裏的嘗試:Use border image only for bottom border? Our CSS seems to replicate the image across the whole div instead用作下邊框的圖像:可能在「後」僞元素中重複圖像並控制背景大小?

現在我們試圖使用「後」僞元素作爲邊界底部圖像。

問題是我們無法在content屬性中定義圖像的大小,也不能在僞元素的整個寬度上重複該圖像的大小。這可能嗎?

+0

你是如何使用它? – BoltClock 2012-04-16 20:47:23

+0

我們將圖片放入內容屬性中,但我們無法設置圖片的高度和寬度,也無法重複。 – Crashalot 2012-04-16 20:49:41

回答

3
.some-div:after { 
    content: ''; 
    display: block; 
    width: 100px; /* example */ 
    height: 2px; 
    background: url('../images/path-to-your-image.png') repeat-x; 
} 

你只需要添加一些基於你的代碼(float,absolute,anything)的定位。

+0

我喜歡這個解決方案:) – Gajotres 2015-04-03 18:02:28