Margin: 0px; body {margin: 0px; padding: 0px; text-align: center; } #content { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
Margin: 0px; body {margin: 0px; padding: 0px; text-align: center; } #content-top { margin-left:auto; margin-right:auto; width: 400px; width: 370px; } #content-end {margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
Margin: 0px; body {margin: 0px; padding: 0px; text-align: center; } #content-top { margin-left:auto; margin-right:auto; width: 400px; width: 370px; } #content-mid { margin-left:auto; margin-right:auto; width: 400px; width: 370px; } #content-end { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
# bodyCenter {width: 700px; margin-right: auto; margin-left: auto; overflow: auto; } #bodycenter #dv1 {float: left; width: 280px; } #bodycenter #dv2 {float: right; width: 410px; }
#header{width: 700px; margin-right: auto; margin-left: auto; overflow: auto; } #bodycenter { width: 700px; margin-right: auto; margin-left: auto; overflow: auto; } #bodycenter #dv1 { float: left; width: 280px; } #bodycenter #dv2 { float: right; width: 410px; }
#header{width: 700px; margin-right: auto; margin-left: auto; } #bodycenter {width: 700px; margin-right: auto; margin-left: auto; } #bodycenter #dv1 { float: left; width: 280px; } #bodycenter #dv2 { float: right; width: 410px; } #footer{ width: 700px; margin-right: auto; margin-left: auto; overflow: auto; }
#left {position: absolute; top: 0px; left: 0px; width: 120px; } #middle {margin: 20px 190px 20px 190px; } #right {position: absolute; top: 0px; right: 0px; width: 120px; }
Float locates an XHTML: <div id=”warp”> <div ID =”column”> <div ID =”column1″> Here is the first column <div id=”column2″> here is the second column <div class=”clear”>
#wrap{width:100%; height:auto; } #column{ float:left; width:60%; } #column1{ float:left; width:30%; } #column2{ float:right; width:30%; } #column3{ float:right; width:40%; } .clear{ clear:both; }
<div id=”center” class=”column”>
This is the main content.
This is the left sidebar.
This is the right sidebar.
CSS: the following is the reference fragment: body {margin: 0; padding-left: 200px; padding-right: 190px; min-width: 240px; } .column {position: relative; float: left; } #center {width: 100%; } #left {width: 180px; right: 240px; margin-left: -100%; } #right {width: 130px; margin-right: -100%; }
Two lines and three columns XHTML: Here are the quotes: <div ID =”header”> this is the top row <div ID =”warp”> <div ID =”column”> <div ID =”column2″> this is the first column <div id=”column2″> this is the second column <div class=”clear”>
#header{width:100%; height:auto; } #wrap{ width:100%; height:auto; } #column{ float:left; width:60%; } #column1{ float:left; width:30%; } #column2{ float:right; width:30%; } #column3{ float:right; width:40%; } .clear{ clear:both; }
Three lines and three columns XHTML: Here are the quotes: <div ID =”header”> this is the top row <div ID =”warp”> <div ID =”column”> <div ID =”column2″> this is the first column <div id=”column2″> this is the second column <div class=”clear”>
#header{width:100%; height:auto; } #wrap{ width:100%; height:auto; } #column{ float:left; width:60%; } #column1{ float:left; width:30%; } #column2{ float:right; width:30%; } #column3{ float:right; width:40%; } .clear{ clear:both; } #footer{width:100%; height:auto; }
PS: This is a list of common examples, not for research purposes, for each box, there is no margin,padding, Boeder and other attributes! ———————————————— Copyright notice: This article is originally published BY CSDN blogger “JSship” under the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement. The original link: blog.csdn.net/jsship/arti…