1 <HTML>2 <Head>3 <styletype= "Text/css">4 *{/*Initialize Code*/5 margin:0;padding:0;font-size:12px;font-family:song body, Arial;letter-spacing:Normal;6 }7 . P{/*Parent Box*/8 Border:Solid 1px Red;9 padding:0px;Ten width:500px; One font-size:0px;/*Core code for Inline-block layout 1*/ A letter-spacing:-8px;/*compatible with Apple browser, negative values are not valid for other browsers*/ - margin:5px Auto; - text-align:Center;/*Auxiliary code for inline-block layout 1*/ the } - . P Div{/*Sub-box*/ - Display:Inline-block;/*Core code for Inline-block layout 2*/ - Border:Solid 1px Red; + vertical-align:Top;/*Auxiliary code for Inline-block layout 2*/ - } + . P Div{ A *display:inline;/*complementary code, specifically for IE6 and IE7 compatible syntax, only in this way IE6/7 show the appearance of Inline-block*/ at } - </style> - </Head> - <Body></Body> - </HTML>
Inline-block Layout Code