CSS3的新增样式:圆角边框、盒子阴影、文字阴影

目录

一、圆角边框 border-radius

1、原理及语法

2、使用效果

二、盒子阴影 box-shadow

1、语法

2、练习-鼠标经过出现阴影的效果

三、文字阴影 text-shadow

1、语法 


一、圆角边框 border-radius

1、原理及语法

radius半径原理:圆与边框的交集形成圆角的效果。

length越大,圆角越大越圆

        语法:1、 border-radius:length;                如border-radius: 10px;

                   2、border-radius: 百分比;            如border-radius: 50px;

                       百分比就是高度和宽度的一半,50%就是圆形写法

2、使用效果

(1)圆形

        语法: border-radius: 2/width或者50%

(2)圆角矩形     (常用)

        语法:border-radius:  length;

(3)不同圆角        

        语法:border-radius: length  length length length;

length可以是数值或者百分比,这四个值分别表示左上角、右上角、右下角、左下角 。

二、盒子阴影 box-shadow

1、语法

box-shadow: h-shadow  v-shadow  blur  spread  color  inset;

 color一般写法:rgba(0,0,0,0.5)

注意:不可以写outset,会导致阴影无效;阴影不占用空间,不会影响排列。

2、练习-鼠标经过出现阴影的效果

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: pink;
        }

        div:hover {
            box-shadow: 20px 20px 10px 5px rgba(0, 0, 0, 0.3);
        }
    </style>
</head>

<body>
    <div></div>
</body>

</html>

三、文字阴影 text-shadow

1、语法 

text-shadow: h-shadow  v-shadow  blur  color;

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值