CSS学习第三章(文字相关样式)

1.text系列

1.1text-align: 设置文本对齐方式

  • left :左对齐
  • right:右对齐
  • center:居中对齐

p{ text-align:center; }

1.2 text-indent:设置首行缩进

  • 2em; 缩进两个字

p{ text-indent:2em; }

1.3 text-decoration: 设置文本的修饰

  • none:没有修饰
  • line-through : 删除线
  • underline :下划线
  • overline : 上划线
p {
   text-decoration:none;
   text-decoration:underline;
   text-decoration:overline;
   text-decoration:line-through;
  }

1.4color: 设置文本颜色

p{ color:red; } 

 2.font系列

2.1font-size : 设置字体尺寸

2.2 font-weight: 设置字体是否加粗

  • bold : 加粗
  • normal: 正常

2.3 font-style:设置字体是否斜体

  • italic: 斜体
  • normal : 正常

2.4 line-height: 设置文字的行高

  • 数字 : 表示字体的倍数
  • 行高指的是文字和前后的空间总共占据的高度,行高越大,行间距越大
  • 特殊用法:单行文本垂直居中,把line-height设置为height相同的值
    p {
      font-weight: bold;
      font-style:italic;
      font-size: 20px;
      line-height: 40px;
      line-height: 2;   /*   -->40px */
    }

2.5 font-family:设置字体的族类

    p {
      font-family: "宋体";
      font-family: "Helvetica Neue", "Helvetica,Arial", "Microsoft Yahei", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", "sans-serif";
    }

2.6 font : 字体系列属性的简写

  • 可设置的属性是(按顺序): "font-style font-variant font-weight font-size/line-height font-family"
  • 简写属性值顺序不能随意调整
  • 至少包含font-size和font-family两个值
p{
 font: italic bold 20px/2 "宋体";
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值