What is a DIV - Why does it matter
As it is widely used to group elements, it ends up being a facilitator for organizing information within a layout. In this way, it is possible to format and manipulate the elements, including the div itself, through CSS in an organized way. It is usually accompanied by ID and class attributes, in order to facilitate this organization and formatting.
How to create one: tag <DIV>
The syntax of the HTML DIV element is through the opening <div> and closing </div>. By default, the DIV generates an automatic line break when used. This is because it has a standard display block element. Therefore, to use the DIV, just place the elements you want inside the <div> </div> tag as in the syntax below:
We can always include any other HTML elements, that is, other tags, within an HTML DIV.
The HTML DIV element can have among the following attributes:
- ID → defines an ID;
- Class → defines a class;
- Title → defines a title;
- Height → defines a height;
- Width → defines a width;
ID X Class
An ID is a unique configuration, that is, we can only use and ID in just a single element. A class is a configuration that can be used in more than one element.