Masthead

DIV Tags

"DIV" tags are used heavily in web pages these days as they provide a "blank slate" to manage HTML elements. "div" is short for divider but a "div" tag is really just a box that you can put HTML into and then control it with CSS and JavaScript. Below is a simple example of a div tag with some text and an image included:

<div style="font: 40px Arial, Helvetica, Verdana, sans-serif;color: #000;background-color:#FF0000;">
This is some text.
</div>

This produces:

This is some text.

Note that you could do the same thing with a paragraph but the paragraph has padding around it by default (like the other text on this page). Thus, div tags provide a blank slate with no presets. We'll explore divs more in the lab.

© Copyright 2018 HSU - All rights reserved.