Elements & Attributes

We refer to everything between a start tag and an end tag as an HTML Element.

<tagname>Content . . .</tagname>

Not every element has to have content, and elements can be nested within other elements.

<body>

<p>This is a paragraph that is nested within the body tags.</p>

</body>

While most browsers will accept uppercase tags, it is generally good practice to always use lowercase tags - so <p> not <P>.

HTML Elements can themselves have attributes, which convey additional information about the element. We add attributes inside the start tag and they generally are a pair of items, with the first one being the name of the attribute and the second one being the value.

For example, when we learn about inserting images, we might see something like this:

<img src="imagename.jpg" width="200" height="150">

The src, width, and height are all names of the attributes, and the imagename.jpg, 200 and 150 are the associated values.

There are many HTML attributes.