css

144 阅读1分钟

字体粗细font-weight 中bold number

实现标题的变细

不加单位

文字样式font-style

em {

/* 让倾斜的字体不倾斜 */

font-style: normal;

}

字体的复合属性

body{

/* 复合属性:简写的方式 */

/* font:font-style font-weight font-size/line-height font-family */

font: italic 700 16px 'Microsoft YaHei';

}

使用font属性时,不能更换顺序,各个属性间以空格隔开

必须保留font-size,font-family

css文本属性

颜色 对齐文本 text-align

h1 {

/* 让h1中文字水平居中对齐 右对齐 */

/* text-align: center; */

text-align: right;

}

装饰文本 text-decoration

div {

/*下划线 */

/* text-decoration: underline; */

/* 删除线 */

/* text-decoration:line-through; */

/* 上划线 */

text-decoration:overline;

}

a {

/* 取消a默认的下划线 */

text-decoration:none;

}

记住添加下划线,删除链接默认的下划线

文本缩进

段落的第一行缩进 text-indent:2em; em是一个相对单位,1个em是一个文字的大小

行间距

line-height 上下间距距离