-CSS属性(红色表示常用)
可继承属性:父标签的属性值会传递给子标签,
一般都是文字控制属性
a.所有标签可继承()
visibility、cursor
b.内联标签可继承
letter-spacing、word-spacing、white-space、line-height、color、font、font-family、font-size、font-style、font-variant、font-weight、text-decoration、text-transform、direction
c.块级标签可继承
text-indent、text-align
d.列表标签可继承
list-style、list-style-type、list-style-position、list-style-image
visibility、cursor
b.内联标签可继承
letter-spacing、word-spacing、white-space、line-height、color、font、font-family、font-size、font-style、font-variant、font-weight、text-decoration、text-transform、direction
c.块级标签可继承
text-indent、text-align
d.列表标签可继承
list-style、list-style-type、list-style-position、list-style-image
不可继承属性:父标签的属性值不能传递给子标签,
一般是区块控制属性
display、margin、border、padding、background
height、min-height、max-height、width、min-width、max-width
overflow、position、left、right、top、bottom、z-index
float、clear
table-layout、vertical-align
page-break-after、page-bread-before
unicode-bidi
height、min-height、max-height、width、min-width、max-width
overflow、position、left、right、top、bottom、z-index
float、clear
table-layout、vertical-align
page-break-after、page-bread-before
unicode-bidi
-常用属性代码演示:
a.background
/*background是复合属性,包含背景颜色和背景图片,其中背景图片默认平铺*/
/*background: blue;*/
background: url("img/1.jpg");
/*设置北京图片不平铺*/
background-size: cover;
b.visibility 规定元素是否可见
/*
visible:可见(默认)
hidden:元素是不可见的
collapse:当在表格元素中使用时,此值可删除一行或一列,
但是它不会影响表格的布局。被行或列占据的空间会留给其他内容使用。
如果此值被用在其他的元素上,会呈现为 "hidden"。
inherit: 规定应该从父元素继承 visibility 属性的值。
*/
visibility: hidden;
c.cursor规定要显示的光标的类型(形状)
/*
常用的有:
crosshair:光标呈现为十字线。绘图的时候多用
pointer: 光标呈现为指示链接的指针(一只手)
move: 此光标指示某对象可被移动。
help: 帮助
*/
cursor: pointer;
d .overflow:处理超出的内容
/*
hidden:超出隐藏
scroll:超出滚动
auto:超出滚动
*/
overflow: auto;
/* 设置字体样式 */
font-family: "Times New Roman";
/* 设置段落的字体的粗细 */
font-weight: bolder;
/* text-decoration:设置元素的文本修饰 */
text-decoration: underline;
/*通常用于去除下划线*/
text-decoration: none;
<span> </span> /*首行缩进*/
text-indent: 30px;
<span> </span> text-indent: 7%;
<span> </span> /*list-style:列表类型*/
/*最主要的用途是去除列表前的符号*/
list-style: none;