CSS2技术讲解_Margin、Padding and Border

Padding 指的是内容和内容边距之间的空间
Border指的是在方框每一边上的直线
Margin指的是一个标签和另一个标签间的间隔
[caption id=”attachment_323” align=”alignnone” width=”355”]Margin、Padding and Border Margin、Padding and Border[/caption]

Margin 和 padding的快捷设定

margin:0 5px 5px 5px ;
padding: 5px 5px 5px 5px;其顺序是:top right bottom left 等同于padding:5px;
若css属性上值为0;则可以简写,如 margin:0;
Margin:0 2em;指的是top和bottom为0;left和right为2em;

Border 属性

border:2px solid black;
也可以对单个边进行设定:border-bottom:2px solid black;

实例如下:ex4_box.html->ex4_box2.html
[caption id=”attachment_324” align=”alignnone” width=”722”]ex4_box.html->ex4_box2.html ex4_box.html->ex4_box2.html[/caption]

用over-flow属性控制溢出文本

Over-flow有4个属性
visible: 可见的
scroll: 添加滚动条
auto: 自动处理,需要的时候添加滚动条
hidden: 隐藏超出边框的内容