Front-end web page learning 3 (css text attributes and text attributes)
Css font attributes
Css font attributes:
- font-family: font;
- font-size: font size;
- font-weight: font weight;
- font-style: font;
normal writing: (notes are in the code remarks)
.font {
font-family: '宋体',Arial, Helvetica, sans-serif;
/* 单引号双引号都可以 */
/* 从左往右显示 */
/* 尽量使用常用字体 */
/* body字体设置 */
font-size: 20px;
/* 字体大小 */
/* px像素 默认16 */
/* 尽量自己设置防止不同浏览器显示不同 */
font-weight: 600;
/* 字体粗细 */
/* 不加单位400normal */
font-style: italic;
/* 斜体 */
}
Abbreviation:
fixed order font-font size-font weight-font. At
least two attributes of font size and font are required
.font-new1 {
font: italic 700 16px '宋体'
}
.font-new2 {
font: 36px '宋体'
}
Css text attributes
Color
:
- red
- #cc0000
- reg(255,0,1)
- reg(100%,10%,10%)
Align
textalign horizontally :
- left (default)
- right
- center;
Text
-decoration:
- none (default) none
- underline
- overline
- line-through
Indent the first line
text-indent:
- 100px (right indentation) px pixels
- -20px (left indentation)
- 3em (one word) em
Line spacing
line-height: 50px;
p {
color: red;
text-align: left;
text-decoration: overline;
text-indent: 0em;
line-height: 0em;
}