CSS盒模型

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title></title>
        <style>
            div{
                width: 200px;
                height: 200px;
                padding:20px;          (内边距)
                border: 10px solid #000;  (边框) 
                margin: 50px;          (外边距)
            }
        </style>
    </head>
    <body>
        <div></div>
    </body>
</html>

 

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title></title>
        <style>
            div{
                width:20px;
                padding:10px 20px 30px 40px;
                background-color: pink;
            }
        </style>
    </head>
    <body>
        <div>
            文字
        </div>
    </body>
</html>
                               边框border
(solid实线;dashed虚线;dotted点线;double双线;groove凹陷;ridge凸陷等)
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title></title>
        <style>
            p{
                width:200px;
                height:200px;
                background: cyan;
                border:10px solid #f00;
                border-width:10px 20px 30px 40px;
                border-style: solid double dashed dotted;
                border-color: #FF0000 #abc #f0a #ab0;
            }
        </style>
    </head>
    <body>
        <p>
            普通段落
        </p>
    </body>
</html>

 

上一篇:用CSS来实现一些动画在vue中使用之流星滑过(3)


下一篇:CSS之旋转