- p {
- font-family: "微软雅黑";
- }
- h2 {
- font-family: "Microsoft YaHei",Arial;
- }
- p {
- font-size: 20px;
- }
- p {
- font-weight: normal | bold | bolder | lighter | number
- }
normal:正常字体,默认值
blod:粗体
bolder:特粗体
lighter:细体
number:数字 (后面不要加单位) 开发时常用
示例,标题在使用的时候经常去掉加粗
- h2 {
- font-weight: 400;
- }
- p {
- font-style: normal | italic;
- }
- div {
- font: italic(font-style) 700(font-weight) 16px(font-size/line-hight) 'Microsoft yahei'(fonnt-family);
- }
font-size和font-family属性,否则 font(整个css属性) 都不起作用- div {
- color: red;
- }
- div {
- text-align: center | left | right;
- }
- p {
- text-decoration: none | underline | overline | line-through;
- }
实例:去除链接的下划线
- a {
- text-decoration: none;
- }
- p {
- text-indent: 20px | 2em;
- /* 首行缩进20px */
- /* 2em是当前2个文字大小 */
- }
- p {
- line-height: 26px;
- }