• div border-radius画圆


    不要指定border-width属性:

    <html>
    <style type="text/css">
    div{
        border-style: solid;
        background-color: #f00;
        border-width: 50px;
        border-radius: 50px;
        width: 100px;
        height: 100px;
    }
    
    </style>
    <body>
        <div></div>
    </body>
    </html>

    效果:

    去掉border-width属性

    <html>
    <style type="text/css">
    div{
        border-style: solid;
        background-color: #f00;
        border-radius: 50px;
        width: 100px;
        height: 100px;
        background-color: #000;
        
    }
    
    </style>
    <body>
        <div></div>
    </body>
    </html>

    效果:

    怎么是106和106?

    去掉

    border-style: solid;
    <html>
    <style type="text/css">
    div{
        background-color: #f00;
        border-radius: 50px;
        width: 100px;
        height: 100px;
    }
    
    </style>
    <body>
        <div></div>
    </body>
    </html>

     所以如果你想要在:before中画一个圆,则必须让:before是一个block

    <html>
    <style type="text/css">
    div{
        margin: 400px;
    }
    div:before{
        content: "";
        display: block;
        background-color: #f00;
        border-radius: 50px;
        width: 100px;
        height: 100px;
    }
    
    </style>
    <body>
        <div></div>
    </body>
    </html>
  • 相关阅读:
    Intellij Idea非常6的10个姿势!
    java 集合
    oracle sql调优
    springboot
    整理的java jdk1.8跟mybatiseplus
    java8中lambda的用法(map转list,list转map等等
    遍历数组中的元素(含es6方法)
    云计算初探
    转FMS小工具用法
    Flex内存消耗
  • 原文地址:https://www.cnblogs.com/ghgyj/p/4034089.html
Copyright © 2020-2023  润新知