css-6.文本格式化

来源:互联网 发布:java快速开发平台比较 编辑:程序博客网 时间:2024/05/28 04:55
1.指定字体
font-family:value1,value2;

2.字体大小
font-size:value;

3.字体加粗
font-weight:normal、bold、value

4.字体样式
font-style:normal、italic

5.小型大写字母
fonnt-variant:normal、small-caps
eg:
font-family: "微软雅黑","宋体","Arial";
/*一般来说如果是中文就用中文字体,如果是数字和字母就用英文字体(Arial,Times)
* 微软雅黑 类似Arial
* 宋体类似Times
* */
font-size: 16px;
font-weight: bold;
font-style: italic;
font-variant: small-caps;
控制文本格式
·文本颜色color:value
·文本排列text-align:left、right、center
·文本修饰text-decoration:none、underline
#a1{
text-decoration: none;
color: orangered;
}
·行高line-height:value;如果是多行文字,间距增加,单行文字,设置line-height的值等于height,文字垂直居中
·首行文本缩进textinde:value;   text-indent: 2em;首行文本缩进可以用em做单位,多个段落必须放在独立的p便签,不然浏览器不会识别为段落
·文本阴影text-shadow:h-shadow v-shadow blur color;text-shadow: 1px 1px 0px red;

溢出
overflow: hidden;
/*文本溢出属性,必须建立在overflow:hidden*/
white-space: nowrap;
/*nowrap文字不换行,normal正常*/
text-overflow: clip;
/*clip 裁剪 。ellipsis 显示···*/
换行
word-break:break-all长单词换行
word-break:keep-all换行   长单词不换行
word-break:normal   系统默认

空格
letter-spacing: 2em;
原创粉丝点击