doraemon的python 格式化排版
1765243235
### 11.5 常用格式化排版
文字文本属性
```css
/*为网页中的文字设置默认字体为微软雅黑*/
body{
font-family:'Microsoft yahei'
}
/*备选字体*/
body{
font-family:'Microsoft yahei','宋体','黑体'
}
```
网页中的字体一般为16px
字体样式:
- normal 默认的,文本设置为普通字体
- italic 如果当前字体的斜体版本可用,那么文本设置为斜体版本;如果不可用,那么就会利用onlique状态来模拟italic。常用
- oblique 将文本设置为斜体的模拟版本,也就是将普通文字倾斜样式应用到文本中。
```html
<head>
<meta charset='UTF-8'>
<title>字体样式</title>
<style type="text/css">
p{
font-style:italic;
}
i{
font-style:normal;
}
</style>
</head>
<body>
<p>
普通字体样式
</p>
<i>
斜体样式
</i>
</body>
```
字体粗细 font_weight:
- narmal
- bold
- lighter
- bolder
- 100-900
文本修饰text-decoration:
- none
- underline
- overline
- linethrough 删除线
文本缩进 text-indent:
```html
<style>
p{
text-indent:32px;
}
</style>
<p>
捡垃圾管理局垃圾狗会就看见昂紫卡红
</p>
```
行间距 line-height:
```css
p{
font-size:20px;
text-indent:2em;
lin-height:2em; 两倍行间距
}
```
文字间间隔和字母间间距
```css
p{
letter-spacing:5px; 文字之间的的距离
word-spacing:5px; 字幕之间的距离
}
```
文本对齐text align:
- left
- right
- center
盒子模型
margin:在水平方向上不会出现问题,垂直方向上会出现塌陷问题












