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>
    效果展示:
     
  • 相关阅读:
    《软件方法》读书笔记2
    《代码阅读方法与实践》读书笔记3
    课堂讨论记录
    《代码阅读方法与实践》读书笔记2
    [洛谷] P1948 [USACO08JAN]Telephone Lines S(二分+SPFA)
    2020 CCPC秦皇岛 正式赛题解
    [洛谷] P3146 [USACO16OPEN]248 G (区间DP)
    [进阶指南] 最大子序和
    [训练] 图的K步移动最大收获
    [计蒜客] 受力平衡(组合数学 + 乘法逆元)
  • 原文地址:https://www.cnblogs.com/wang-yong-kang0/p/13177435.html
Copyright © 2011-2022 走看看