实例
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title></title> <style> *{ padding: 0; margin: 0; } header{ width: 100%; height: 100px; background-color: aqua; } nav{ width: 100%; height: 100px; background-color: chocolate; } main{ /*将行级元素转换为块级元素*/ display:block; width: 100%; height: 500px; background-color:moccasin; } main >article{ width: 80%; height: 100%; background-color: blueviolet; float: left; } main >aside{ width: 20%; height:100%; background-color: deeppink; float:right; } footer{ width: 100%; height: 100px; background-color: cornflowerblue; } </style> </head> <body> <header>头部</header> <nav>导航</nav> <main> <article>左边</article> <aside>右边</aside> </main> <footer>底部</footer> <!-- <div class="header"></div> <div class="nev"></div> <div class="minContent"> <div class="left"></div> <div class="riht"></div> </div> <div class="footer"></div> --> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例