清除浮动-额外标签法
- <title>清除浮动-额外标签法</title>
- <style>
- .father {
- margin: 10px auto;
- width: 1200px;
- /* height: 300px; */
- background-color: pink;
- }
-
- .left {
- float: left;
- width: 200px;
- height: 300px;
- background-color: skyblue;
- }
-
- .right {
- float: right;
- width: 950px;
- height: 300px;
- background-color: orange;
- }
-
- .bottom {
- height: 100px;
- background-color: brown;
- }
-
- .clearfix {
- clear: both;
- }
- </style>
- </head>
- <body>
- <div class="father">
- <div class="left"></div>
- <div class="right"></div>
- <div class="clearfix"></div>
- </div>
- <div class="bottom"></div>
- </body>
复制代码
|