CSS3 文本效果

1,text-shadow

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>CSS3</title>
  <link rel="stylesheet" href="">
  <style type="text/css">
    *{
      padding: 0;
      margin: 0;
    }
    p{
      margin: 20px;
      padding: 20px;
      text-shadow: 5px 5px 5px #f40;
    }
  </style>
</head>
<body>
  <p>This is a p label</p>
</body>
</html>

这四个属性分别为水平阴影,垂直阴影,模糊距离,阴影颜色

2,box-shadow

适用于给盒子加阴影

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>CSS3</title>
  <link rel="stylesheet" href="">
  <style type="text/css">
    *{
      padding: 0;
      margin: 0;
    }
    div{
      margin: 20px;
      padding: 20px;
      width: 100px;
      height: 100px;
      background-color: #f40;
      box-shadow: 5px 5px 5px #000;
    }
  </style>
</head>
<body>
  <div>This is a div label</div>
</body>
</html>

3,text-overflow

指定用户如何显示溢出的内容

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>CSS3</title>
  <link rel="stylesheet" href="">
  <style type="text/css">
    *{
      padding: 0;
      margin: 0;
    }
    p{
      margin: 20px;
      padding: 20px;
      width: 100px;
      height: 100px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  </style>
</head>
<body>
  <p>This is a p labelThis is a p labelThis is a p labelThis is a p labelThis is a p labelThis is a p label</p>
</body>
</html>

4,word-wrap

强制文本换行,会把长文本分割掉

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>CSS3</title>
  <link rel="stylesheet" href="">
  <style type="text/css">
    *{
      padding: 0;
      margin: 0;
    }
    p{
      margin: 20px;
      padding: 20px;
      width: 100px;
      height: 100px;
      word-wrap: break-word;
    }
  </style>
</head>
<body>
  <p>This is a p label This is a p labelXXXXXXX</p>
</body>
</html>

5,word-break

指定了单词拆分换行

--------------------------------------------

参考文章:https://www.runoob.com/css3/css3-text-effects.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值