123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <!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>
- .main {
- border: 2px solid #000;
- }
- .one {
- background: #f00;
- float: left;
- width: 200px;
- height: 200px;
- font-size: 30px;
- color: #fff;
- }
- .two {
- background: #0f0;
- float: left;
- width: 200px;
- height: 200px;
- font-size: 30px;
- color: #fff;
- }
- .three {
- background: #00f;
- float: left;
- width: 200px;
- height: 200px;
- font-size: 30px;
- color: #fff;
- }
- img {
- float: left;
- }
- </style>
- </head>
- <body>
- <!-- <img src="../day1/images/img01.gif" alt="">
- <img src="../day1/images/img01.gif" alt="">
- <img src="../day1/images/img01.gif" alt=""> -->
- <!--
- 为什么使用浮动:想让元素在一行显示
- float:left/right;
- 问题:浮动会导致父元素高度塌陷
- 因为浮动会让元素脱离文档流 不占位
- -->
- <div class="main">
- <div class="one">1</div>
- <div class="two">2</div>
- <div class="three">3</div>
- 我是一段话
- </div>
- </body>
- </html>
|