我想在後臺.jpeg圖自動縮放到DIV(lineholder)的高度,而不管子DIV的數量(鏈接持有者) - 和在相同的時間有一些文本在父DIV內垂直對齊。IE11不支持背景大小的比例
該代碼在Chrome和Firefox中全部工作 - 但IE11完全忽略了背景大小。
我的HTML標記看起來是這樣的:
<div id="active-container" class="ac1">
<div id="lineholder" style= "background-image: url(....); background-repeat: no-repeat; background-size: 44px 100%;">
<div id="text">
TEST
</div>
<div id="linkholder">
</div>
<div id="linkholder">
</div>
</div>
</div>
CSS:
#active-container {
min-width : 240px;
min-height : 26px;
height : auto;
float : left;
}
#lineholder {
position : relative;
min-width : 240px;
height : auto;
overflow : hidden;
}
#text {
position : absolute;
top : 50%;
margin : -13px 0 0 0;
width : 45px;
height : 26px;
left : 0px;
font-size : 8px;
font-weight : bold;
line-height : 26px;
}
#linkholder {
margin-left : 45px;
min-height : 26px;
width : 190px;
position : relative;
}
IE11只是表明我lineholder的左上角的原始背景圖像 - 而所有其他瀏覽器擴展高度以適應DIV。
看到這裏http://6710.sunnysite.dk/background-size_debug.jpg
背景圖像的CSS是因爲需要一個人與現在的HTML CSS的知識來插入不同的背景圖像多個人lineholders在所有的HTML裏面的圖片;)所以不同class'es等不是一種選擇。
我覺得這就是一個重複:http://stackoverflow.com/questions/22615336/background-size-cover-ie11-not-covering - 全區域 – 2014-09-25 07:05:34
你可能會在那裏找到你的答案 – 2014-09-25 07:06:12
IE瀏覽器不縮放 - 背景寬度也應該固定爲44px,因此它不完全相同;) – 2014-09-25 07:25:29