Difference between <div> and <span>

Difference between

1 Like

The div should be used to wrap sections of a document, while span is used to wrap small portions of text, images, etc. The < div > element is used to create layouts in html, while <span> is used to stylize the different forms of text.

Both the HTML tags < div > and < span > are used to represent the part of the webpgage. < div > tag is used a as block part of the webpage and < span > tag is used as a inline part of the webpage

The div tag is known as Division tag. The div tag is used in HTML to make divisions of content on the web page like (text, images, header, footer, navigation bar, etc). This HTML tag has both opening < div > and closing (</ div >) tags and it is mandatory to close the tag. Div tag accepts align attribute. This tag should be used to wrap a section, for highligting that section.

The HTML span tag is a generic inline container for inline elements and content. It used to group elements for styling purposes (by using the class or id attributes). Span tag does not accept align attribute. This tag should be used to wrap any specific word that you want to highlight in your webpage.