仅当元素在运行时不适合页面/容器时,才会发生这种情况。

示例1-我强迫div以固定的高度/宽度滚动

示例2-如果浏览器窗口太小而无法容纳,则它们将重叠

示例3-无重叠

如果删除以下css块,则问题将消失。有任何想法吗?

/* CSS3 BUTTON ICON METHOD, DOESN'T SUPPORT IE7 */
*[class*="icon-"]:before {
background-image: url("http://i.imgur.com/NwDXbMb.png");
content: "";
height: 16px;
width: 16px;

display: block;
float: left;

vertical-align: middle;
margin-right: 6px;

/*position:relative;*/
/*background-attachment: scroll;*/
background-repeat: no-repeat;
background-position: 0px 128px;
}


http://jsfiddle.net/weaponx86/sHnHn/

全屏示例:
http://jsfiddle.net/weaponx86/sHnHn/embedded/result/

最佳答案

解决方案是将:before选择器设置为“ inline-block”并摆脱float:left。

/* CSS3 BUTTON ICON METHOD, DOESN'T SUPPORT IE7 */
*[class*="icon-"]:before /*,.icon:before*/ {
background-image: url("http://i.imgur.com/NwDXbMb.png");

padding:0;

content: "";
height: 16px;
width: 16px;
display: inline-block;

vertical-align: middle;
margin-right: 6px;
text-indent:16px;
/*position:relative;*/
/*background-attachment: scroll;*/
background-repeat: no-repeat;
background-position: 0px 128px;
}


http://jsfiddle.net/weaponx86/sHnHn/7/

10-05 20:33
查看更多