CSS中设置盒子大小-box-sizing,设置盒子阴影- box-shadow ,设置盒子圆角-border-radius,属性及其属性值

一:设置盒子大小-box-sizing

默认情况下:盒子可见宽的大小由内容区,内边距,边框共同决定

box-sizing 属性用来设置盒子尺寸的计算方式, 也就是 width/height 指的是谁

        可选值:

                content-box 内容区 默认值

                border-box 宽度和高度用来设置整个盒子可见框的大小,包括边框,padding,内容区

二:设置盒子阴影- box-shadow( 参数1,参数2,参数3,参数4)

设置元素的阴影效果,不会影响到页面布局

        第一个值:水平偏移量 正->左 负->右

        第二个值:垂直偏移量 正->下 负->上

        第三个值:模糊半径

        第四个值:颜色

三:设置盒子圆角-border-radius

border-radius 用来设置圆角   以XXpx为半径画圆

        还可以单独设置一角的圆角

                border-top-right-radius

                border-top-left-radius

                border-bottom-left-radius

                border-bottom-right-radius

        设置圆形

        border-radius: 50%;

<!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>
      .box{
            width: 100px;
            height: 100px;
            background-color: red;
            border: 10px solid yellowgreen;
            box-sizing:border-box;   
          }
      .box1 {
        width: 200px;
        height: 200px;
        background-color: #f60;
        box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5);
      }
      .box2 {
        width: 200px;
        height: 200px;
        background-color: #bfa;
        /* border-radius: 10px  50px; */
        /* border-radius:50%; */
        border-top-right-radius:50px;
      }
 
    </style>
  </head>
  <body>
    <!-- 阴影例子 -->
    <div class="box1 box"></div>
    <!-- 圆角例子 -->
    <div class="box2"></div>
    
  </body>
</html>
  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

趋之

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值