margin-left 之百分号 IE7
当外层容器为float,并且需要自适应宽度,不设定宽度里面div使用百分号作为margin的值,想要在容器中居中,IE7下如果设置的百分比不是针对的外层容器的宽度,而是由外层容器向上递归找到的那个设置了宽度的容器的宽度,导致撑的将外层容器撑的很宽如:.inverted_triangle{ width:0px; height:0; margin-
当外层容器为float,并且需要自适应宽度,不设定宽度
里面div使用百分号作为margin的值,想要在容器中居中,IE7下如果设置的百分比不是针对的外层容器的宽度,
而是由外层容器向上递归找到的那个设置了宽度的容器的宽度,导致撑的将外层容器撑的很宽
如:
.inverted_triangle{
width:0px;
height:0;
margin-left: 44%;
border-top:5px solid #85ACD7;
border-right:5px solid white;
border-bottom:5px solid white;
border-left:5px solid white;
position: relative;
}
margin-left改成left貌似可以解决
.inverted_triangle{
width:0px;
height:0;
left: 44%;
border-top:5px solid #85ACD7;
border-right:5px solid white;
border-bottom:5px solid white;
border-left:5px solid white;
position: relative;
}
更多推荐
所有评论(0)