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>
相关推荐
lcc1873 小时前
CSS3 新增盒子属性
css3
_码力全开_5 小时前
第一章 html5 第一节 HTML5入门基础
前端·javascript·css·html·css3·html5
KLW757 小时前
vue v-if和v-show比较
前端·css·css3
旧梦吟1 天前
脚本网站 开源项目
前端·web安全·网络安全·css3·html5
程序员修心1 天前
CSS 选择器知识点
前端·css·css3
开发者小天2 天前
React中useCallback的使用
前端·javascript·react.js·typescript·前端框架·css3·html5
weixin_440730502 天前
css的选择器
前端·css·css3
程序员刘禹锡2 天前
文档流与盒子模型 (12.25日)
前端·css·css3
温轻舟2 天前
圣诞节雪人动态效果 | HTML页面
开发语言·前端·javascript·html·css3·温轻舟·圣诞
摆烂z2 天前
CSS Flex布局简单入门笔记
css·笔记·css3