zoukankan      html  css  js  c++  java
  • 4.盒子模型的属性,定位以及浮动定位(菜鸟学前端)

    盒子模型

    常用属性简介:

    基本写法:

     border:3px solid(实线) red;

    margin外边距

    padding内边距

    注意1::内外边距是相对的属性

    注意2:默认内边距影响盒子大小

    box-sizing: border-box(固定盒子的大小)

    float:浮动

    浮动有两个属性left和right,

     代码演示:

    内边距方法:

    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>css属性</title>
        <style>
            div{
                border:3px solid red;
                height: 200px;
                 200px;
                padding:50px ;
                box-sizing: border-box;
            }
            .div1{
                border:3px solid green;
                height: 100px;
                 100px;
     
            }
        </style>
    </head>
    <body>
        <div>
        <div class="div1"></div>
    </div>
    </body>
    </html>
     
    外边距方法:
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>css属性</title>
        <style>
            div{
                border:3px solid red;
                height: 200px;
                 200px;
                margin-left:200px ;
                margin-top: 200px;
               
            }
            .div1{
                border:3px solid green;
                height: 100px;
                 100px;
                margin:50px;
       
            }
        </style>
    </head>
    <body>
        <div>
        <div class="div1"></div>
    </div>
    </body>
    </html>
    效果展示:
     
  • 相关阅读:
    BZOJ1040: [ZJOI2008]骑士
    Codeforces 849D.Rooter's Song
    POJ4852 Ants
    NOIP模拟赛 17.10.10
    Codeforces 851D Arpa and a list of numbers
    BZOJ2529: [Poi2011]Sticks
    BZOJ1826: [JSOI2010]缓存交换
    POJ3579 Median
    codevs1214 线段覆盖
    POJ2230 Watchcow
  • 原文地址:https://www.cnblogs.com/wang-yong-kang0/p/13177435.html
Copyright © 2011-2022 走看看