CSS3 新特性 box-shadow 阴影效果、圆角border-radius

圆角


使用CSS3 border-radius属性,你可以给任何元素制作"圆角",border-radius属性,可以使用以下规则:

(1)四个值:第一个值为左上角,第二个值为右上角,第三个值为右下角,第四个值为左下角

(2)三个值:第一个值为左上角,第二个值为右上角和左下角,第三个值为右下角

(3)两个值:第一个值为左上角与右下角,第二个值为右上角与左下角

(4)一个值:四个圆角值相同

如果想要图形变为圆角效果,只需要添加一个属性就行了,border-radius 这个属性。如果想圆的厉害那么这个值就变大一些。

html 复制代码
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <style>
       div{
            width: 100px;
            height: 100px;
            background-color: rgb(151, 26, 49);
            border-radius: 10px;
       }

       img{
        width: 100px;
        height: 100px;
        border-radius: 10px;
       }
    </style>
</head>
<body>
   <div>
    <img src="../vue/1.jpg">
   </div>
</body>

</html>

如果想要变为圆形,那么就写100%就行了。

box-shadow 阴影效果


margin: 0 auto:上下不需要管,auto是让左右的空间平均分配,然后让盒子在中间,这就是居中。让左右空间的间隙平均分配就是auto的作用。

0代表水平方向没有阴影,第二个0代表垂直方向没有阴影,第三个是阴影的模糊度。

html 复制代码
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link href="" type="text/css" rel="stylesheet"/>
    <style type="text/css">
        div{
            width: 500px;
            height: 500px;
            background-color: greenyellow;
            margin: 0 auto;
            box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
        }
    </style>
</head>

<body>
    <div class="d1">
    </div>
</body>

</html>
相关推荐
金灰14 小时前
CSS3练习--电商web
前端·css·css3
吕永强15 小时前
CSS相关属性和显示模式
前端·css·css3
吕永强1 天前
CSS概述
前端·css·css3
过期的H2O21 天前
【H2O2|全栈】关于CSS(10)CSS3扩充了哪些新鲜的东西?(三)
前端·css·css3
小小李程序员1 天前
CSS3渐变
前端·css·css3
荆州克莱2 天前
GPT与大模型行业落地实践探索
spring boot·spring·spring cloud·css3·技术
码农幻想梦3 天前
html5 + css3(上)
前端·css3·html5
与妖为邻4 天前
好玩的水表电表
css·html·css3·好玩的电表水表
码农幻想梦4 天前
html5 + css3(下)
前端·css3·html5
儒雅的烤地瓜4 天前
CSS | 面试题:你知道几种移动端适配方案?
css·html·css3·vw·媒体查询·移动端适配·vh