`

css入门之布局

    博客分类:
  • css
阅读更多

margin:0 auto;

        margin后面如果只有两个参数的话,第一个表示top和bottom,第二个表示left和right;因为0 auto,表示上下边界为0,左右则根据宽度自适应相同值(即居中)

 

浮动(float)和 绝对定位(position:absolute),可以让元素脱离文档流。

 

绝对定位:position:absolute;right:0;

 

清除浮动:overflow: (hidden/auto);

 

div宽度自适应如何适应?

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics