Web前端连载

mac2024-05-06  39

Css外联样式表参数

1.常用的相对单位2.Css字体样式表3.CSS文本样式4.外联样式表的引用5.整体运用

1.常用的相对单位

px 根据屏幕像素确定 em 表示元素字体高度 ,根据字体 font-size 属性值来确定,例如

p{font-size: 12px;line-height: 28px;}

line-height 去表示行距

2.Css字体样式表

①font- size 去设置字体大小

font- size:20px 相对大小

②font-style 字体风格 风格中主要常用 italic斜体 normal 表示不用斜体,是默认值

font-style : italic

③font-family 字体名,默认宋体 ④font-weight 设置字体粗细

font-weight:bold 标准粗体 bolder 特粗体 lighter 细体

3.CSS文本样式

①line-height 行距

line-height:20px;

②text-indent 首行缩进

text-indent:2em;

em是相对单位,表示首行缩进两个字符 ③ 字符装饰 text-decoration属性,主要有上划线,下划线,删除线

text-decoration:none| underline| overline| line-through;

4.外联样式表的引用

<link rel="stylesheet" href="../css/qingniao.css">

上一层文件夹中css文件夹下qingniao.css文件,是此文件的路径

5.整体运用

h1{font-size: 18px; /*字体大小*/ line-height: 40px; /*行间距*/ text-align: center /*居中*/ color: #666666; /*字体颜色*/ text-indent: 2em; /*首行缩进2字符*/ }
最新回复(0)