自丢网

标题: css3盒子模型案例附代码与教程 [打印本页]

作者: admin    时间: 2020-1-6 11:31
标题: css3盒子模型案例附代码与教程
css3盒子模型案例附代码与教程
先看下代码案例:
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7.     <title>css3盒子模型案例-IT战蚁</title>
  8.     <style>
  9.         div:nth-child(1) {
  10.             width: 200px;
  11.             height: 200px;
  12.             background-color: pink;
  13.             border: 5px red solid;
  14.             padding: 10px;
  15.         }
  16.         div:nth-child(2) {
  17.             width: 200px;
  18.             height: 200px;
  19.             background-color: pink;
  20.             border: 5px red solid;
  21.             padding: 10px;
  22.             box-sizing: border-box;
  23.         }
  24.     </style>
  25. </head>

  26. <body>
  27.     <div></div>
  28.     <div></div>
  29. </body>
  30. </html>
复制代码
代码运行结果:
(, 下载次数: 681)