CSS——字体与文本

187 阅读1分钟

一、字体样式

字体大小:font-size

字体倾斜:font-style

字体加粗:font-weight

行高:line-height

字体名称:font-family

字母小写转大写:font-variant

二、文本样式

颜色:color

文本装饰:text-decoration

字母文本大小写:text-transform

文字字间距:letter-spacing

单词字间距:word-spacing

文字阴影:text-shadow

首行缩进:text-indent

水平对齐方式:text-aline

垂直对齐方式:vertical-align

空格处理方式:white-space

自动换行:word-wrap

溢出显示(...):text-overflow

第几行溢出显示(...):-webkit-line-clamp

三、实例

<!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <title>文字阴影</title>
      <style>
        .aa{
           font-size:22px;
           text-shadow:3px 3px 0 #FFFF00,6px 6px 0 aqua,9px 9px 0 blue;
           color:red;
           word-spacing:5px;
           text-align:center;
           line-height: 48px;
         }
     </style>
  </head>
  <body>
     <div class='aa'>Hello world!</div>
  </body>
</html>