一、布局属性
width
描述:设置对象的宽度
语法:width:value;
height
描述:设置对象的高度
语法:height:value;
overflow
描述:溢出的处理
语法:overflow:visible(可见)|hidden(隐藏)|scroll(滚动);
二、边框属性
border-top-width
描述:设置上边框的宽度
语法:border-top-width:value;
border-top-style
描述:设置上边框的线型
语法:border-top-style:none|solid(实线)|dotted(点划线);
border-top-color
描述:设置上边框的颜色
语法:border-top-color:value;
border-top(补P68[2])
描述:设置上边框的属性
语法:border-top:width style color;
border
描述:设置边框的属性
语法:border:width style color;
三、内边距与外边距
3.1 外边距
margin-top
描述:设置顶部的外边距
语法:margin-top:value;
margin-right
描述:设置右侧的外边距
语法:margin-right:value;
margin-bottom
描述:设置底部的外边距
语法:margin-bottom:value;
margin-left
描述:设置左侧的外边距
语法:margin-left:value;
margin(补P70[3])
描述:设置外边距
语法:margin:value(四个方向相同);
margin
描述:设置外边距
语法:margin:上下 左右;
margin
描述:设置外边距
语法:margin:上 左右 下;
margin
描述:设置外边距
语法:margin:上 右 下 左;
padding-top
padding-right
padding-bottom
padding-left
padding
padding
padding
padding
四、盒子模型(BoxModel)
对象的宽度 = 左侧外边距 + 左侧边框 + 左侧内边距 + 宽度 + 右侧内边距 + 右侧边框 + 右侧外边距
五、背景属性
background-color
描述:设置背景颜色
语法:background-color:value;
background-image
描述:设置背景图像
语法:background-image:url(图像URL);
background-repeat
描述:设置背景图像的平铺方式
语法:background-repeat:no-repeat|repeat|repeat-x|repeat-y;
background-attachment
描述:设置背景图像的依附方式
语法:background-attachment:scroll|fixed;
background-position
描述:设置背景图像的位置
语法:background-position:水平 垂直;
水平:left|center|right|value
垂直:top|center|bottom|value;
说明:图像的坐标原点(0,0)位于文档的左上角。
所以,水平向左移动为负值;垂直向上移动为负值。
background(补P73[3])
描述:设置背景属性
语法:background:color url(图像URL) repeat
attachment 水平 垂直;
标准文档流(正常文档流),HTML元素在浏览器
显示的顺序由HTML标记的书写顺序决定。
如果为块级对象则垂直排列;如果为内联对象则水平排列。
六、浮动定位
float
描述:设置对象的浮动
语法:float:left|right;
说明:
A.对象浮动后,将脱离标准文档流。
B.float属性设置为left时,对象将尽量向左移动,
直到父对象的边界或上一个浮动对象的边界为止。
C.当(所有)子对象在方向上存在浮动属性时,其父对象的高度将清除为零。
D.
clear
描述:清除浮动
语法:clear:left|right|both;
七、列表属性
list-style
描述:设置列表样式
语法:list-style:none;
CSS基础02
最新推荐文章于 2024-09-26 19:50:45 发布