css阴影怎么做

box-shadow为CSS阴影设置,其中分为外阴影和内阴影,一般默认为外阴影

  1. 外阴影的属性为:X轴 Y轴 px color
    属性说明(顺序依次对应): 阴影的X轴(可以使用负值) 阴影的Y轴(可以使用负值) 阴影模糊值(大小) 阴影的颜色
<style>
 .one{
  margin: auto;
  width: 200px;
  height: 200px;
  border: 1px solid #ffa;
  box-shadow: 0 0 20px #000;
 }
</style>
<body>
<p class="one"> 
</p>
</body>

其结果为:

9ae2670e474170593ee3562fac154bbc

  1. 内阴影的属性为:X轴 Y轴 px color inset
    属性说明(顺序依次对应): 阴影的X轴(可以使用负值) 阴影的Y轴(可以使用负值) 阴影模糊值(大小) 阴影的颜色 inset
<style>
 .one{
  margin: auto;
  width: 200px;
  height: 200px;
  border: 1px solid #ffa;
  box-shadow: 0 0 20px #000 inset;
 }
</style>
<body>
<p class="one"> 
</p>
</body>

其结果为:

51ac5f1c7b4b5dd491add456ed03e44b

若配合css3动画效果,会更加神奇

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容