Nested Div Tag With Center Aligned

If you want to align Div Tags like this image…

Download Code

Capture

Following is the code

<html>
<head>
<title></title>
<style type=”text/css”>
div
{
margin:auto;
}
#dv1{height:450px;width:500px;background-color:Blue;padding-top:50px;}
#dv2{height:350px;width:400px;background-color:Green;padding-top:50px;}
#dv3{height:250px;width:300px;background-color:Yellow;padding-top:50px;}
#dv4{height:150px;width:200px;background-color:Red;padding-top:50px;}

</style>
</head>
<body>

<div id=”dv1″>
<div id=”dv2″>
<div id=”dv3″>
<div id=”dv4″>
</div>
</div>
</div>
</div>

</body>
</html>

Advertisements

One thought on “Nested Div Tag With Center Aligned

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s