|
@@ -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>
|
|
|
+ #part1 {
|
|
|
+ float: left;
|
|
|
+ /* display: inline-block; */
|
|
|
+
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+ margin-top: 10px;
|
|
|
+ background: red;
|
|
|
+ }
|
|
|
+ #part2 {
|
|
|
+ float: left;
|
|
|
+ /* display: inline-block; */
|
|
|
+
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+ margin-top: 10px;
|
|
|
+ background: yellow;
|
|
|
+ }
|
|
|
+ #part3 {
|
|
|
+ float: left;
|
|
|
+ /* display: inline-block; */
|
|
|
+
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+ margin-top: 10px;
|
|
|
+ background: blue;
|
|
|
+ }
|
|
|
+ #part4 {
|
|
|
+ float: left;
|
|
|
+ /* display: inline-block; */
|
|
|
+
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+ margin-top: 10px;
|
|
|
+ background: pink;
|
|
|
+ }
|
|
|
+ #part5 {
|
|
|
+ float: left;
|
|
|
+ /* display: inline-block; */
|
|
|
+
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+ margin-top: 10px;
|
|
|
+ background: purple;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <!--
|
|
|
+ 想让元素在一行展示
|
|
|
+ 浮动:float
|
|
|
+ left right none
|
|
|
+ 会使元素脱离文档流 不占位
|
|
|
+ 问题:导致父元素高度塌陷
|
|
|
+ -->
|
|
|
+ <div class="box">
|
|
|
+ <div id="part1"></div>
|
|
|
+ <div id="part2"></div>
|
|
|
+ <div id="part3"></div>
|
|
|
+ <div id="part4"></div>
|
|
|
+ <div id="part5"></div>
|
|
|
+ </div>
|
|
|
+ </body>
|
|
|
+</html>
|