Lio*_*ior 2 html centering
我目前有一个固定宽度为900px的div. 我想添加一个固定宽度为950px的儿童iframe,我希望它与中心完美对齐. 怎么办?
谢谢.
Guf*_*ffa 5
您可以将孩子置于50%,然后使用负边距,该边距是孩子宽度的一半:
.parent { position: relative; overflow: hidden; } .child { position: absolute; left: 50%; top: 0; margin-left: -475px; }
这样,您只需要知道子元素的大小.
归档时间:
14 年,8 月 前
查看次数:
2574 次
最近记录:
9 年,4 月 前