1.

What is the difference between <div> and <span> tags?

Answer»

<div> and <span> both are HTML elements that are used to represent a section on the website. The differences between them are:

<div> tag
<span> tag
<div> is a block-level element. It is used for creating block parts of the website.
<span> is an inline element. It is used for creating inline parts of the website.
<div> tag is generally used for creating SECTIONS.
<span> tags are generally used to add STYLES to inline elements like text. For example, to highlight only a few words in a paragraph, you can wrap the words WITHIN <span> tags and APPLY styles to those elements only.
<div> tag accepts the align attribute.
<span> tag does not accept the align attribute


Discussion

No Comment Found