CSS笔记(黑马程序员pink老师前端)圆角边框

圆角边框

border-radius:length;

效果显示

html 复制代码
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    * {
        margin: 0;
        padding: 0;
    }

    div {
        display: inline-block;
        margin-top: 20px;
        margin-left: 30px;
        background-color: pink;
    }

    .div1 {
        /* 圆角边框,用半径为10px的圆,切原有的矩形 */
        border-radius: 10px;
        height: 100px;
        width: 200px;
    }

    .div2 {
        /* border-radius的值也可为百分比,当切角圆的
        半径为正方形的一半时,显示为圆形 */
        border-radius: 50%;
        height: 100px;
        width: 100px;
    }

    .div3 {
        /*圆的半径为高度的一半 */
        border-radius: 60px;
        height: 100px;
        width: 200px;
    }

    .div4 {
        /*依次设置不同的角 */
        border-radius: 10px 20px 40px 80px;
        height: 100px;
        width: 200px;
    }

    .div5 {
        /*只有两个值,为对角线关系 */
        border-radius: 40px 10px;
        height: 100px;
        width: 200px;
    }

    .div6 {
        /*单独设一个角,top与left的顺序不能变 */
        border-top-left-radius: 20px;
        height: 100px;
        width: 200px;
    }
</style>

<body>


    <div class="div1"></div>
    <div class="div2"></div>
    <div class="div3"></div>
    <div class="div4"></div>
    <div class="div5"></div>
    <div class="div6"></div>
</body>

</html>
相关推荐
2303_Alpha几秒前
SpringBoot
笔记·学习
溯水流光几秒前
React 源码解析
前端
睡不着先生1 分钟前
CSS `:has()` 实战指南:让 CSS 拥有“if 逻辑”
css
光影少年4 分钟前
Typescript工具类型
前端·typescript·掘金·金石计划
北风GI8 分钟前
如何在 vue3+vite 中使用 Element-plus 实现 自定义主题 多主题切换
前端
月亮慢慢圆8 分钟前
网络监控状态
前端
_AaronWong13 分钟前
实现 Electron 资源下载与更新:实时进度监控
前端·electron
Doris_202314 分钟前
Python条件判断语句 if、elif 、else
前端·后端·python
Doris_202319 分钟前
Python 模式匹配match case
前端·后端·python
森林的尽头是阳光33 分钟前
vue防抖节流,全局定义,使用
前端·javascript·vue.js