1.CSS让DIV水平居中
.mydiv{
margin:0 auto;
width:300px;
height:200px;
}
2.CSS实现水平和垂直居中
.mydiv{
width:300px;
height:200px;
position:absolute;
left:50%;
top:50%;
margin:-100px 0 0 -150px
}
3.jQuery实现水平和垂直居中
本文介绍了使用CSS和jQuery实现DIV元素的水平与垂直居中布局的方法,包括绝对定位技巧和jQuery简化操作。
1405

被折叠的 条评论
为什么被折叠?



