以居中为中心后的div余量(Offseting div margin after centering it)
我有一个以另一个div为中心的div:
<div id="align" style = "width: 420px; margin:auto; ">div始终位于中心,这很好,但是,
如何将它偏移60px(或任何其他距离)到右边?
I have a div centered in another div with:
<div id="align" style = "width: 420px; margin:auto; ">The div stays always in the center and that's fine but,
how do I offset it 60px (or any other distance) to the right?
最满意答案
您可以移动div并使用position:relative使其居中
#align { width: 420px; margin:auto; position:relative; left:60px; }<div id="align"></div>You can move the div and still have it centered using position:relative
#align { width: 420px; margin:auto; position:relative; left:60px; }<div id="align"></div>
更多推荐
发布评论