标签:
1两列
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>两列布局</title> <style type="text/css"> .left{ float: left; width: 300px; height: 300px; background-color: red; } .right{ margin-left: 300px; height: 300px; background-color: blue; } </style> </head> <body> <!--两列布局,其中左侧部分宽度固定、右侧部分宽度随浏览器宽度的变化而自适应变化--> <div class="left">left</div> <div class="right">right</div> </body> </html>
2.三列
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>三列布局</title> <style type="text/css"> .main{ width: 100%; float: left; height: 50px; background-color: blue; } .left{ width: 150px; height: 50px; background-color: red; float: left; margin-left: -100%;/*垂直向上挪*/ } .right{ width: 200px; height: 50px; background-color: red; margin-left: -200px; float: left; } </style> </head> <body> <!--实现一个三列布局,其中左侧和右侧的部分宽度固定,中间部分宽度随浏览器宽度的变化而自适应变化--> <div class="main aaa">main</div> <div class="left">left</div> <div class="right">right</div> </body> </html>
标签:
原文地址:http://www.cnblogs.com/syyy/p/5865369.html