[问题] 第二层Div的文字置中

楼主: qazsd ( )   2016-10-19 17:56:18
<div id="div1" class="test" style="backgroud>
<div id="div2">This is the word</div>
</div>
想请教要让div2的文字水平方向是置放在div1的中间
然后垂直方向是低于div1 200px
CSS该怎么下才好?
作者: nottt (无)   2016-10-19 20:06:00
https://jsbin.com/xefaxalufo/edit?html,css,output不知道你要的是不是这样,利用margin让div2低于div1 200px
作者: steven11329 (清新柳橙)   2016-10-20 14:35:00
div2 margin:auto; margin-top:200;忘记加px不过你的div1要指定宽度才有效说错是div2要加text-align: center;

Links booklink

Contact Us: admin [ a t ] ucptt.com