Divs and HTML Attributes

Now that you know basic HTML, we'll be taking a more granular look at HTML.

We'll be checking out two very useful concepts in HTML: Divisions and HTML attributes.

Divs

A div is short for division and is used to help create sections within our HTML.

Divs aren't visible unless we add styling to it but you can think of divs as a way to separate and contain HTML code.

<div> 
    <h1>This header tag is contained within a div!</h1> 
</div>

The above code is also called, "nesting", because we can "nest" code within other code! This is usually done by indenting.

HTML Attributes

HTML Attributes are a way for our HTML elements to have additional information.

Remember image tags? We had to pass in additional data about the source and alternate description.

<img src='image.jpg' alt='example-image'>

In the above example, "src" and "alt" are HTML attributes of the image HTML tag.