|
October 20, 2001 DIV's Dimensions Tips: October 2001
Yehuda Shiran, Ph.D.
|
|
The DIV element is very popular in DHTML-based pages. You can include other elements, text, and graphics inside it. It is interesting to note the dimensions of a DIV element, and how they change according to its content. Here is a DIV element that contains nothing:
And it looks like this:
Hello there!
You can see that the DIV's dimensions extend to include the elements inside the DIV. Now, let's add a marker as well:
The outcome is as follows:
Hello there!
Notice that the DIV element does not include the marker's image. Of course, you can control the dimensions yourself. When you set the DIV element's height as follows:
you'll get the right dimensions:
Hello there!
People who read this tip also read these tips: Look for similar tips by subject: |