css:有关字体和文本的属性以及属性的继承

一.字体属性

1.color:字体颜色

2.font-size: 字体大小

3.font-family:字体

4.font-weight: bolder; 字体加粗 范围在100-900

5.font-style: oblique和italic :文字样式 斜体

6.px em:相对于父元素字体大小(默认的字体是16px)

7.rem 相对于根元素字体的大小(默认字体大小是16px) 屏幕适配方法

二.文本类

1、text-align:文本内容的水平对齐方式 (left / right /center )

2、ext-decoration :文本修饰

underline:下划线
overline:上划线
none:不做修饰
line-through:删除线

3、line-height:行间距
垂直居中:单行文字。行间设置和容器高度一样

4、text-indent:缩进

三、属性的继承

属性的继承:有时候,我们给一个元素设置样式后,他的子代样式也发生了变化,即子代继承了父级的属性。
1.可继承的属性:

(1)font字体系列:font、font-size、font-style、font-family、font-weight等。

(2)文本类:color、text-indent、text-align、line-height等

(3)光标属性:cursor

(4)可见性:visibility

(5)表格属性:border-spacing、border-collapse、caption-side等

(6)列表属性:list-style、list-style-type、list-style-position等

(7)声音样式属性:volume、voice-family、speak等

(8)页面样式属性:page、windows、orphans等

2.不可继承的属性:

(1)文本属性:vertical-align、text-decoration

(2)盒子模型:margin、padding、width、height、border 等

(3)背景属性:background、background-color、background-image、background-repeat(背景平铺)、background-position(北京定位)

(4)display、margin、border、padding、background

(5)定位属性:position、float、overflow、z-index 、left、right、top、 bottom等

(6)高、宽属性:height、min-height、max- height、min-width、max-width

3.所有元素可以继承的属性

(1)元素可见性:visibility

(2)光标属性:cursor

4.内联元素可以继承的属性

(1)字体系列属性

(2)除text-indent、text-align之外的文本系列属性

5.块级元素可以继承的属性

text-indent、text-align

猜你喜欢

转载自blog.csdn.net/qq_50487248/article/details/127166147
今日推荐