在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>
<div class="one"> 
</div>
</body>

其结果为:

在这里插入图片描述

  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>
<div class="one"> 
</div>
</body>

其结果为:

在这里插入图片描述

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

猜你喜欢

转载自blog.csdn.net/weixin_44545501/article/details/87864910