1.因为矩形用的绝对定位,所以我找它的父容器,结果我发现body的width是0,这应该是矩形的绝对定位脱离了正常的流造成的。那么我给body涂背景色为什么又会充满整个屏幕呢(body.width=0)? 此时矩形定位的根容器是谁?整个浏览器对于的那个对象是谁?
2.我画了两个小圆,他们的容器是矩形吗?定位方式是static(也就是没有定位,在正常的流中),还是继承矩形的定位absolute,还是其他方式? 我觉得应该不是static. 此时应该还没有流,因为body此时的width还是0
3.display的inline,inline-block,block和position有什么关系或者说是相互的限制,冲突?
(比如 如果是inline。 此时不能用的position有哪些. 因为width,height失效(仅仅是打个比方))
问题比较多,求大神一个个耐心解答
#rectangle{
width:400px;
height: 200px;
background-color: #ccc;
position: absolute;
top:50%;
left:50%;
margin-top: -100px;
margin-left: -200px;
overflow:hidden;
}
#circle-lt{
background-color: #fc0;
width: 100px;
height: 100px;
border-radius: 50%;
transform:translate(-50px,-50px);
}
#circle-rb{
background-color: #fc0;
width: 100px;
height: 100px;
border-radius: 50%;
transform:translate(350px,50px);
}
body{
background-color: red;
}