|
@@ -0,0 +1,71 @@
|
|
|
|
|
+<!DOCTYPE html>
|
|
|
|
|
+<html lang="en">
|
|
|
|
|
+<head>
|
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
+ <title>Document</title>
|
|
|
|
|
+ <style>
|
|
|
|
|
+ /* 块元素如果不设置宽度 会默认占满父元素的宽度 */
|
|
|
|
|
+ /* 块元素如果不设置高度 会根据内容撑开 */
|
|
|
|
|
+ .box{
|
|
|
|
|
+ border:1px solid black;
|
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .item1{
|
|
|
|
|
+ background-color: blue;
|
|
|
|
|
+
|
|
|
|
|
+ float: left;
|
|
|
|
|
+ }
|
|
|
|
|
+ /* 清除浮动 工具类 */
|
|
|
|
|
+ .clearfix::after{
|
|
|
|
|
+ content: "";
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ clear: both;
|
|
|
|
|
+ }
|
|
|
|
|
+ .item2{
|
|
|
|
|
+ background-color: red;
|
|
|
|
|
+ float: right;
|
|
|
|
|
+ }
|
|
|
|
|
+ .item{
|
|
|
|
|
+ width: 100px;
|
|
|
|
|
+ height: 100px;
|
|
|
|
|
+ color: white;
|
|
|
|
|
+ font-size: 50px;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ margin:10px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ line-height: 100px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .item3{
|
|
|
|
|
+ background-color: green;
|
|
|
|
|
+ float: left;
|
|
|
|
|
+ }
|
|
|
|
|
+ .item4{
|
|
|
|
|
+ background-color: orange;
|
|
|
|
|
+ margin:10px auto;
|
|
|
|
|
+ }
|
|
|
|
|
+ .item5{
|
|
|
|
|
+ background-color: green;
|
|
|
|
|
+ float: right;
|
|
|
|
|
+ }
|
|
|
|
|
+ </style>
|
|
|
|
|
+</head>
|
|
|
|
|
+<body>
|
|
|
|
|
+ <!-- 一个标签中可以写多个类名 -->
|
|
|
|
|
+ <div class="box clearfix">
|
|
|
|
|
+ <div class="item1 item">1</div>
|
|
|
|
|
+ <div class="item1 item">2</div>
|
|
|
|
|
+ <div class="item1 item">3</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="box clearfix">
|
|
|
|
|
+ <div class="item2 item">1</div>
|
|
|
|
|
+ <div class="item2 item">2</div>
|
|
|
|
|
+ <div class="item2 item">3</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="box">
|
|
|
|
|
+ <div class="item3 item">左</div>
|
|
|
|
|
+ <div class="item5 item">右</div>
|
|
|
|
|
+ <div class="item4 item">中</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</body>
|
|
|
|
|
+</html>
|