div CSS Page Layout instance: Implementing Multiple div Alignment Centers

Source: Internet
Author: User
Tags min xmlns
css| Web page

<?xml version= "1.0" encoding= "iso-8859-1"? ><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "><ptml xmlns=" http://www.w3.org/1999/xhtml "><pead><title>untitled document</title> <meta http-equiv= "Content-type" content= "text/html; Charset=iso-8859-1 "/><style type=" Text/css ">body {text-align:center} #outer {width:60%; background: #ffffcc ; Margin:auto; Text-align:center}. inner {width:100px; height:100px; margin:5px; border:1px solid #000;} * HTML. Inner {display:inline}/* for ie*/html>body #outer {display:table}/*for Mozilla */html>body. Inner {display: table;float:left}/*for Mozilla */@media All and (min-width:0px) {/* Opera 7 styles */html>body. Inner {display:inline-b Lock;float:none}} </style></pead><body><!--Force quirks mode by using the XML pro-logue--><div id= "outer" > <div class= "inner" >test</div> <div class= "Inner ">2</div> <div class=" inner ">3</div> <div class=" inner ">4</div> <div class= "Inner" >5</div> <div class= "inner" >6</div> <div class= "inner" >7</div> <div class = "inner" >8</div> <div class= "inner" >9</div> <div class= "inner" >10</div> <div class= "inner" >11</div> <div class= "inner" >12</div> <div class= "inner" >13</div> &LT;BR style= "Clear:both"/></div></body></ptml>

    [Ctrl + a ALL SELECT hint: You can modify some of the code, and then run]

<?xml version= "1.0" encoding= "iso-8859-1"
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
<title>untitled document< /title>
<meta http-equiv= "Content-type" content= "text/html; charset=iso-8859-1"/>
<style type= " Text/css
Body {text-align:center}
#outer {
 width:60%;
 background: #ffffcc;
 margin:auto;
 text-align:center;
}
. inner {
 width:100px;
 height:100px;
 margin:5px;
 border:1px solid #000;
}
* html. Inner {display:inline}/* for ie*/
Html>body #outer {display:table}/*for Mozilla */
Html> Body. Inner {display:table;float:left}/*for Mozilla */
@media All and (min-width:0px) {/* Opera 7 styles */
Html> Body. Inner {Display:inline-block;float:none}
}

</style>
<body>
<!--force quirks mode by using the XML Pro-logue-->
<div id= "outer" >
<div class= "inner" >test</div>
<div class= "inner" >2</div>
<div class= "inner" >3</div>
<div class= "inner" >4</div>
<div class= "inner" >5</div>
<div class= "inner" >6</div>
<div class= "inner" >7</div>
<div class= "inner" >8</div>
<div class= "inner" >9</div>
<div class= "inner" >10</div>
<div class= "inner" >11</div>
<div class= "inner" >12</div>
<div class= "inner" >13</div>
<BR style= "Clear:both"/>
</div>
</body>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.