HTML ATTRIBUTES pt. 1

Supposedly...

HTML attributes are special words used to define characteristics, behavior, or properties of an element.

Dafuq does that mean

All elements can have attributes.
Attributes give extra information to the browser about an element (where a link goes, which image to display, etc.).
Attributes are always defined in the the opening tag of an element and are usually followed by an equals sign and quotation marks.

An example

Remember how I mentioned that I consider <div> to be a box?
If you created a div without any attributes, this is what it would look like.

  This is a div

Using attributes, you can modify that particular element (in this particular case, the div).
For example, you can add a border!

  This is a div

You can change the width of the element.

  This is a div  

You can change the height.

  This is a div  

You can vertically align the content.

  This is a div  

You can do all sorts of things!

  This is a div  

  This is a div  

  This is a div  

  This is a div  

  This is a div  

As you can see from the examples above, the div itself remains a div but attributes give it character.
Attributes are used to change the behavior or display of an HTML element.
Next, let's learn about some of the most commonly used HTML attributes.

Next: HTML Attributes pt. 2

Return to previous page
Return to main page