div {
margin: auto;
position: absolute;
top: 0;
left: 0;
right: 0
bottom: 0;
width: 100px;
height: 100px;
border:1px solid red;
}
将产生一个div, width: 100px; height: 100px; 外边框 1px 红色实线 ;
div居于屏幕中间,对于居于中间这点,我无法理解,为何下面的做法不可以?
div {
margin: auto;
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
border:1px solid red;
}
margin: auto;
position: absolute;
top: 0;
left: 0;
right: 0
bottom: 0;
width: 100px;
height: 100px;
border:1px solid red;
}
将产生一个div, width: 100px; height: 100px; 外边框 1px 红色实线 ;
div居于屏幕中间,对于居于中间这点,我无法理解,为何下面的做法不可以?
div {
margin: auto;
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
border:1px solid red;
}