Using the Div Tag to create boxes and background colors within your text

Here's how to quickly add text highlights, boxes, and other special effects to your web pages.

With HTML there are many ways to create different text effects. But one of the most powerful and easiest to use methods involves the simple div tag.

Here's an example:

Using the div tag I have highlight this text, placed a box with a dotted line around it, added padding to the left, right, top, and bottom of the text, and could include many special text effects.

The secret to the power of the div tag is that you can include any style sheet (CSS) commands with the tag, and they immediately effect all text enclosed with the tag.

The code for the above tag looks like:



Using the div tag I have highlight this text, placed a box with a dotted line around it, added padding to the left, right, top, and bottom of the text, and could include many special text effects.

You can remove or include CSS style elements within the style parameter of the div tag to accomplish the exact effect you are trying for.

To find out more about CSS parameters, see http://www.htmlhelp.com/reference/css/properties.html