zoukankan      html  css  js  c++  java
  • css-盒子模型

    css的盒子模型

      ** 在进行布局前需要把数据封装到一块一块的区域内(div)

      (1)边框

      border:2px solid blue;
      border:统一设置
      上:border-top
      下:border-bottom
      左:border-left
      右:border-right

    <html>
        <head>
            <title>World</title>
            <style type="text/css">        
                div {
                    border:2px solid blue;
                    width:200px;
                    height:100px;
                }
                #div12 {
                    border-right:10px dashed orange;
                }
            </style>
        </head>
        <body>
            
            <div id="div11">AAAAAAAAAAA</div>
            <div id="div12">BBBBBBBBBBB</div>
            <div id="div13">CCCCCCCCCCC</div>
        </body>
    </html>

      效果如下:

    (2)内边距
      padding:20px;
      padding:统一设置
      上:padding-top
      下:paddingr-bottom
      左:padding-left
      右:padding-right
      上下左右四个内边距

    <html>
        <head>
            <title>World</title>
            <style type="text/css">            
                div {
                    border:2px solid blue;
                    width:200px;
                    height:100px;
                }
    
                #div12 {
                    padding:20px;
                }
                #div13 {
                    padding-left:50px;
                }
            </style>
        </head>
        <body>
            <div id="div11">AAAAAAAAAAA</div>
            <div id="div12">BBBBBBBBBBBBBBBBBBBBBBBBb</div>
            <div id="div13">CCCCCCCCCCC</div>
        </body>
    </html>

       效果如下:

      (3)外边距
      margin:20px;
      margin:统一设置
      上:margin-top
      下:margin-bottom
      左:margin-left
      右:margin-right
      上下左右四个外边距

    <html>
        <head>
            <title>World</title>
            <style type="text/css">    
                div {
                    border:2px solid blue;
                    width:200px;
                    height:100px;
                }
                #div12 {
                    margin:30px;
                }
                #div13 {
                    margin-left:30px;
                }
            </style>
        </head>
        <body>
            <div id="div11">AAAAAAAAAAA</div>
            <div id="div12">BBBBBBBBBBB</div>
            <div id="div13">CCCCCCCCCCC</div>
        </body>
    </html>

      效果如下:

  • 相关阅读:
    PHP四种界定符
    设计模式 单例模式与工厂模式
    PHP include与require的区别
    面向对象 static abstract interface 等知识点
    gogland golang 颜色&字体 colors&font 配置文件
    什么是游戏中的帧同步
    kcp协议详解
    kcp流模式与消息模式对比
    kcp源码走读
    kcp结构体字段含义
  • 原文地址:https://www.cnblogs.com/ibabyli/p/9888744.html
Copyright © 2011-2022 走看看