Phone number

Latest news

div & ID element freedcodecamp

The div element, also known as a division element, is a general purpose container for other elements.
The div element is probably the most commonly used HTML element of all. It’s useful for passing the CSS of its own class declarations down to all the elements that it contains.
Just like any other non-self-closing element, you can open a div element with

One cool thing about id attributes is that, like classes, you can style them using CSS.
Here’s an example of how you can take your element with the id attribute of cat-photo-element and give it the background color of green. In your style element:
#cat-photo-element {
background-color: green;
}
Note that inside your style element, you always reference classes by putting a . in front of their names. You always reference ids by putting a # in front of their names.
Try giving your form, which now has the id attribute of cat-photo-form, a green background.