HTML5 Div Tag is useful to define a division on the webpage.
HTML5 Img Tag Example:
<!DOCTYPE html> <html> <head> <title>HTML5 Tutorial</title> </head> <body> <div>Division 1</div>
As you can see above, Div tag is used to define division on the webpage. Each div can have different class or ids and using class or id with CSS, division can have different style on the webpage.
class Attribute: class attribute in div tag is used to provide a class name. Using the class name on css, style can be applied to all those divs with same class.
id Attribute: Unlike class attribute, id attribute must not have same value for more than one div. Value of id attribute has to be unique. Id is used to identify unique element from the DOM.