html CSS3圆角与透明度设置

基本概念

在这里插入图片描述

0、圆角

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>圆角的设置</title>
    <style type="text/css">
        .box{
            width: 300px;
            height: 300px;
            border: 3px solid black;
            background-color: #f0ad4e;
            margin: 50px auto 0;

            border-top-left-radius: 60px 60px;
            border-top-right-radius: 100px;
        }

        .box1{
            width: 300px;
            height: 300px;
            border: 3px solid black;
            background-color: #f0ad4e;
            margin: 50px auto 0;
            /*border-radius: 150px;           !*方式一*!*/
            border-top-right-radius: 150px;
            border-bottom-left-radius: 150px;
        }

        .box2{
            width: 300px;
            height: 300px;
            border: 3px solid black;
            background-color: #f0ad4e;
            margin: 50px auto 0;
            /*border-radius: 150px;           !*方式一*!*/
            border-radius: 50%;                /*方式二:以百分比的形式*/
        }
    </style>
</head>
<body>
        <div class="box"></div>
        <div class="box1"></div>
        <div class="box2"></div>
</body>
</html>

显示效果如下所示:
在这里插入图片描述

1、盒子透明度设置

在这里插入图片描述
代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>盒子透明度设置</title>
    <style type="text/css">
        .box{
            opacity: 0.1;
            /*兼容IE*/
            filter: alpha(opacity=10);
            background-color: #f0ad4e;
            width: 200px;
            height: 200px;
            margin:50px auto 0;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

效果显示如下:
在这里插入图片描述

2、rgba透明度设置

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>48透明度的设置——rgba</title>
    <style type="text/css">
        body{
            background: url("./images/banner01.jpg");
        }

        .box1{
            width: 300px;
            height: 100px;
            background-color: black;
            color: #ffffff;
            font-size: 20px;
            text-align: center;
            line-height: 100px;

            /*透明度设置*/
            opacity: 0.5;
            filter: alpha(opacity=0.3);     /*兼容IE*/
        }

        .box2{
            width: 300px;
            height: 100px;
            color: #ffffff;
            font-size: 20px;
            text-align: center;
            line-height: 100px;
            margin-top: 45px;

            /*使用rgba*/
            /*background-color: black;*/
            background-color: rgba(0,0,0,0.3);
        }
    </style>
</head>
<body>
        <div class="box1">这是一个盒子模型</div>
        <div class="box2">嗯嗯</div>
</body>
</html>

显示效果如下所示:
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值