Web前端学习笔记——简单页面布局

时间:2025-01-14 19:06:21
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> /*清除默认样式*/ *{ margin: 0; padding: 0; } .header{ width: 1000px; height: 150px; background-color: greenyellow; margin: 0 auto; /*设置居中*/ } .content{ width: 1000px; height: 400px; background-color: yellow; margin: 10px auto; } .left{ width: 200px; height: 400px; background-color: skyblue; float: left; } .center{ width: 580px; height: 400px; background-color: pink; float: left; margin: 0 10px; /*设置水平外边距*/ } .top{ width: 580px; height: 200px; background-color: black; } .bottom{ width: 580px; height: 200px; background-color: teal; } .right{ width: 200px; height: 400px; background-color: red; float: left; } .footer{ width: 1000px; height: 150px; background-color: blue; margin: 0 auto; } </style> </head> <body> <div class="header"></div> <div class="content"> <div class="left"></div> <div class="center"> <div class="top"></div> <div class="bottom"></div> </div> <div class="right"></div> </div> <div class="footer"></div> </body> </html>