标签:
一、理论:二、实践:
1.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style type="text/css" > *{ margin: 0; padding: 0; } .wrapper{ width: 960px; margin-left: auto; margin-right: auto; color:#6bb2ff; font-size: 30px; text-align: center; } #header{ height: 100px; background: #228833; margin-bottom: 10px; } .sidebar{ float:left; width: 220px; margin-right: 20px; margin-bottom: 10px; height: 300px; background: #ebf3fc; } .content{ float:left; width: 720px; height: 300px; background: #ffcc99; margin-bottom: 10px; } #footer{ background: #a6f821; height: 100px; clear: both; } </style> </head> <body> <div class="wrapper"> <div id="header">hedaer</div> <div class="sidebar">left</div> <div class="content">main</div> <div id="footer">footer</div> </div> </body> </html>2.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style type="text/css" > *{ margin: 0; padding: 0; } .wrapper{ width: 960px; margin-left: auto; margin-right: auto; color:#6bb2ff; font-size: 30px; text-align: center; background: #ffcc99; } #header{ height: 100px; background: #228833; margin-bottom: 10px; padding: 10px; width: 100%; } .sidebar{ float:left; width: 220px; margin-right: 20px; margin-bottom: 10px; height: 300px; background: #ebf3fc; padding: 10px; } .content{ float:left; width: 720px; height: 300px; background: #ffcc99; margin-bottom: 10px; padding: 10px; } #footer{ background: #a6f821; height: 100px; clear: both; padding: 10px; width: 100%; } </style> </head> <body> <div class="wrapper"> <div id="header">hedaer</div> <div class="sidebar">left</div> <div class="content">main</div> <div id="footer">footer</div> </div> </body> </html>3.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style type="text/css" > *{ margin: 0; padding: 0; } .wrapper{ width: 960px; margin-left: auto; margin-right: auto; color:#6bb2ff; font-size: 30px; text-align: center; background: #ffcc99; } #header{ height: 100px; background: #228833; margin-bottom: 10px; padding: 10px; width: 100%; border: 10px solid darkgray; } .sidebar{ float:left; width: 220px; margin-right: 20px; margin-bottom: 10px; height: 300px; background: #ebf3fc; padding: 10px; border: 10px solid red; } .content{ float:left; width: 720px; height: 300px; background: #ffcc99; margin-bottom: 10px; padding: 10px; border: 10px solid chartreuse; } #footer{ background: #a6f821; height: 100px; clear: both; padding: 10px; width: 100%; border: 10px solid #202189; } </style> </head> <body> <div class="wrapper"> <div id="header">hedaer</div> <div class="sidebar">left</div> <div class="content">main</div> <div id="footer">footer</div> </div> </body> </html>4.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style type="text/css" > *{ margin: 0; padding: 0; } .wrapper{ width: 960px; margin-left: auto; margin-right: auto; color:#6bb2ff; font-size: 30px; text-align: center; background: #ffcc99; } #header{ height: 100px; background: #228833; margin-bottom: 10px; padding: 10px; width: 100%; border: 10px solid darkgray; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -o-box-sizing:border-box; -ma-box-sizing:border-box; box-sizing: border-box; } .sidebar{ float:left; width: 220px; margin-right: 20px; margin-bottom: 10px; height: 300px; background: #ebf3fc; padding: 10px; border: 10px solid red; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -o-box-sizing:border-box; -ma-box-sizing:border-box; box-sizing: border-box; } .content{ float:left; width: 720px; height: 300px; background: #ffcc99; margin-bottom: 10px; padding: 10px; border: 10px solid chartreuse; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -o-box-sizing:border-box; -ma-box-sizing:border-box; box-sizing: border-box; } #footer{ background: #a6f821; height: 100px; clear: both; padding: 10px; width: 100%; border: 10px solid #202189; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -o-box-sizing:border-box; -ma-box-sizing:border-box; box-sizing: border-box; } </style> </head> <body> <div class="wrapper"> <div id="header">hedaer</div> <div class="sidebar">left</div> <div class="content">main</div> <div id="footer">footer</div> </div> </body> </html>
标签:
原文地址:http://blog.csdn.net/bwshqh/article/details/50919671