我需要編寫頁面底部有一個全寬度箭頭的頁面。因此,我用下面的HTML:如何在CSS中創建動態寬度箭頭?
<div id="footer_wrap">
<div id="footer_left"></div>
<div id="footer_right"></div>
</div>
相關CSS之中:
#footer_wrap{
width: 100%;
}
#footer_left{
background: url('../img/arrow_bg1.png') repeat-x;
width: 100%;
height: 183px;
position: absolute;
left: 0;
}
#footer_right{
display: inline-block;
background: url('../img/arrow_bg2.png') no-repeat;
width: 250px;
height: 183px;
position: absolute;
right: 0;
}
從理論上講,這應該工作 - 而事實上,它做到了,當我用固定的背景顏色的圖像。然而,我的客戶要求他們是透明的,不幸的是我的黑客背後隱藏着醜陋的真相 - 箭頭的「豎井」從箭頭中窺視出來。我能做些什麼呢?
包含箭頭的圖像是一個1x183px的「軸」紋理,它對整個箭頭長度(或者在這種情況下,整個頁面爲[width: 100%]
)重複,箭頭是一個250x183px矩形。
箭頭需要佔用整個頁面,並且需要使用透明圖像,因此這些解決方案不會立即顯示。我想像width: 100%-250px
這樣的東西是可以接受的,但是CSS中不支持這些僞裝。
你需要跨瀏覽器支持,或者您也可以使用類似'盒大小:邊界盒; padding-right:250px;'在footer_left上? –