A DIV element is simply a pair of opening and closing div tags: <DIV><\DIV>
DIVs act as containers for text or various HTML elements, such as images or tables.
The shape of a DIV is a rectangle and its height and width can be set explicitly. If not set,
the DIV's height and width will be controlled by the browser.
Once grouped together inside of a DIV element, the text and other HTML elements can be positioned or
styled as a single unit. This makes DIVs extremely useful for laying out the web page exactly
as envisioned. Some other HTML elements are also frequently used for page layout. How are DIVs
different from each of the following?
Tables
Framesets
iFrames
Layers
Spans
One of the most useful features of DIVs is their ability to automatically show
scroll bars when the DIV contents "overflows" the specified height or width of the
DIV.
This is an example of a DIV element
whose contents are too long and causes scrollbars to appear.
<div style="height:40px;width:150px;"></div>
DIV elements are ideal for producing DHTML. Once a DIV element is given an ID attribute
(such as divMyNotes), JavaScript code can make reference to that DIV and dynamically act upon it, both before and
after the page has been loaded.
One of the simplest ways to reference a DIV through JavaScript is to type:
document.getElementById(''). (The items in
blue will vary depending on the DIV's ID and the result desired. See above for examples.)
The term Tooltips refers to the (usually) yellow box that pops up when the mouse pointer hovers over a
specific word or HTML element. ToolTips can be created by typing
TITLE="..." inside of the HTML tag:
While in Warsaw,
I ate lots of pierogi.