hi KESHAVi PATEL,
The DIV is an entity that naturally has no width or height unless you give it some dimension.
Sort of like a balloon. If you give it air, it will expand, otherwise, it is empty nothingness awaiting your commands.
Also, be careful to check your work in both mozilla firefox and MSIE because they render differently.
If you are using the P tag in your instance below, assign it margin: 0; and padding: 0; which will cause it to render
the same way in both FF and IE.
CSS ::
.topNavigation{
background-color: #ccccff;
width: 200px;
height: 32px;
}
The DIV bg color will now appear within the 200 pixel by 32 pixel boundary that you set.
Try expanding the .top2 width to 200px and see what happens (differently in FF than in IE).
The reason that you see COLOR on the paragraph tag is that it itself has inherent dimensional properties ... that of the text-font contained within the P tags.
You can increase this COLORED area by CSS padding:
p{
margin: 0;
padding: 20px:
}
This carries the COLOR 20 pixels all around the P TAG.
Same with the nested DIVS (.top1, etc.) ... you can assign each their own color since you provided a width and height to them.
However, if you remove the width and height from these, then, the color will appear only within the P TAG. You can visualize this if you assign DIV .top1 background-color: #cccccc;.
I think I got it this time!?!
Al Toman
http://studio9.ws