0
我試圖用這個模板練習:HTML/JSP顯示自定義重複背景圖像表
我用表格來顯示這些書,但我不知道如何顯示此空書架圖像作爲背景:
我試着用TD和TR,但沒有用;我也試過這樣:
#main-table{
margin: 0 auto;
width : 1000px;
background-image: url('images/EmptyWoodenShelf.png');
}
這裏是結果:
那麼,有沒有辦法,讓後大約100像素的背景重複?
UPDATE: 這裏是我的CSS我設定TR背景圖片:
#main-table{
margin: 0 auto;
width : 1000px;
}
#main-table tr{
background-image: url('images/EmptyWoodenShelf.png');
background-position: 0px 100px;
}
.tableitem{
background-image: url('images/BookCover.png');
background-position:center;
width:156px;
height:232px;
margin: 50px 15px;
}
最簡單的解決方案可能是隻作背景圖像100px的高透明的背景下,在頂部貨架。 – Quintile
嘗試'background-position:100px 0px;'..其中第一個值代表水平位置,第二個代表垂直位置。 – Lal
爲什麼不嘗試將背景圖像設置爲「
回答
你必須在空白像素構建到您的書架圖形,這樣的整個高度圖形是100px。
雖然我會建議您將背景圖像添加到TR,並將其放置在底部。這樣你可以直接使用你的圖形。
來源
2015-05-01 17:29:37
檢查這個例子中,我使用一個段落,並給圖像邊界,你想
來源
2015-05-01 17:34:21
您應該使用
第一個值是水平位置,第二個值是垂直的。左上角爲0 0.單位可以是像素(0px 0px)或任何其他CSS單位。如果您只指定一個值,另一個值將爲50%。您可以混合使用%和持倉
查看更多有關它here
來源
2015-05-01 17:34:57 Lal
相關問題