Home  >  Article  >  Web Front-end  >  css+div盒模型研究笔记_html/css_WEB-ITnose

css+div盒模型研究笔记_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:49:57752browse

红色标记的为默认值

1、border(边框):border-top,border-bottom,border-left,border-right

     1.border-color(边框颜色);

     2.border-width(边框粗细):medium|thin|thick|数值;

     3.border-style(边框样式):none|hidden|dotted|dashed|solid|

2、padding(内边距):padding-top,padding-bottom ,padding-left,padding-right

3、margin(外边距):margin-top,margin-bottom ,margin-left,margin-right

当margin设为负数时,会使被设为负数的块向相反的方向移动,设置覆盖在另外的块上。当块之间是父子子关系时,通过设置子块的margin为负数,可以将字块从父块中分离出来。

4、background-color:(背景色)

    1.在给元素设置background-color背景色时,IE作用的区域为content+padding,而Firefox则是content+padding+border。
    2.body是一个特殊的盒子,它的背景色会延伸到margin的部分。

 

属性的简写形式:

       1.如果给出2个属性值,前者表示上下的属性,后者表示左右的属性。

       2.如果给出3个属性值,前者表示上的属性,中间的数值表示左右的属性,后者表示下的属性。

       3.如果给出4个属性值,依次表示上、右、下、左的属性,顺时针排序。

元素的分类

1.块级元素(block):占一行

块级元素div1和div2之间的垂直margin=MAX(div1的margin_bottom,div2的margin-top)

2.行内元素(inline)

行内元素span1和span2之间的水平margin=(span1的margin-right)+(span2的margin-left)

 

盒子的浮动:

1.设置浮动:float:none|left|right

2.清除浮动:clear:none|left|right|both 

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn