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

    每个HTML元素都可以看作一个装了东西的盒子,盒子具有宽度(width)和高度(height),盒子里面的内容到盒子的边框之间的距离即填充(padding),盒子本身有边框(border),而盒子边框外和其他盒子之间,还有边界(margin)。


    布局中的主要样式
    font
    line-height
    color
    margin
    padding
    border
    text-align
    background

     1 <!--
     2 每个HTML元素都可以看作一个装了东西的盒子,盒子具有宽度(width)和高度(height),盒子里面的内容到盒子的边框之间的距离即填充(padding),盒子本身有边框(border),而盒子边框外和其他盒子之间,还有边界(margin)。
     3 -->
     4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     5 <html xmlns="http://www.w3.org/1999/xhtml">
     6 <head>
     7 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
     8 <title>盒子模型</title>
     9 <style>
    10     #bor{
    11         240px;
    12         border:1px dashed;
    13     }
    14     #main{
    15         height:200px;
    16         200px;
    17         margin:20px;
    18         padding:20px;
    19         border:1px solid $000;
    20         background:#eaeaea;
    21     }
    22     span{
    23         100%;
    24         height:100%;
    25         border:1px dashed red;
    26         text-align:center;
    27         padding-top:50%;
    28     }
    29 </style>
    30 </head>
    31 
    32 <body>
    33     <div id="bor">
    34         <div id="main">
    35             <span>内容元素</span>
    36         </div>
    37     </div>
    38 </body>
    39 </html>
  • 相关阅读:
    jdk源码剖析三:锁Synchronized
    ASP.NET的session操作方法总结
    C#文件相同性判断
    C#的DataTable操作方法
    C#二进制流的序列化和反序列化
    C#常用的IO操作方法
    C#缓存操作
    CLR中的程序集加载
    Oracle数据库的SQL分页模板
    奇妙的NULL值,你知道多少
  • 原文地址:https://www.cnblogs.com/Y-HKL/p/5247204.html
Copyright © 2011-2022 走看看