Home >Web Front-end >JS Tutorial >Examples of common CSS website layouts_javascript skills
Single row and one column
The following is a quotation fragment:
body { margin: 0px; padding: 0px; text-align: center; }
#content { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
Two rows and one column
The following is a quotation fragment:
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 ;}
Three rows and one column
The following is a quotation fragment:
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; }
Single row and two columns
The following is a quotation fragment:
#bodycenter { width : 700px;margin-right: auto; margin-left: auto;overflow: auto; }
#bodycenter #dv1 {float: left;width: 280px;}
#bodycenter #dv2 {float: right;width : 410px;}
Two rows and two columns
The following is a quotation fragment:
#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;}
Three rows and two columns
The following is a quotation fragment:
#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; }
Single row and three columns
Absolute positioning
The following is a quotation fragment:
#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 positioning one
xhtml:
The following is a quotation fragment: