1 <!DOCTYPE HTML>2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/>5 <title>Web layout Exercises</title>6 7 <Linkhref=".. /ex_asp_net/css/div.css "rel= "stylesheet" />8 </Head>9 <Body>Ten <H1Align= "Center">Use div and CSS to adjust the layout of the page</H1><HR/> One <Divclass= "D1"> A <H3>Windows 1</H3> - </Div> - <Divclass= "D2"><H3>Windows 2</H3></Div> the <Divclass= "D3"><H3>Windows 3</H3></Div> - </Body> - </HTML>
CSS code:
1 bod{2 margin:100%;3 padding:100%;4 5}6 . D1{7 width:200px;8 Height:600px;9 Background-color:Red;Ten Margin-left:20px; One Margin-top:20px; A position:Absolute; -} - . D2{ the width:800px; - Height:150px; - Background-color:Greenyellow; - position:Absolute; + Left:235px; - Margin-top:20px; + A} at . D3{ - width:800px; - Height:420px; - position:Absolute; - Left:235px; - Background-color:#19a1f8; in Margin-top:200px; - to}
Control page layout with div and CSS styles