There are different kinds of elements (block, inline, table...).
Example for block elements are: h1, p, div, ...
Examples for inline elements are: em, block, span, ...
An block element can contain inline elements and text. Some block elements can contain also other block elements (like div) while others cannot (like p). Block elements start a new line in the text flow.
Inline elements can contain other inline elements and text but not block elements. Inline elements do not start a new line in the text flow.
Since <p> is an block element which should not contain other block elements you shouldn't use a <div> inside. Use the <span> here.
You can't use the div there legally. It's a block element. Span is inline.
Source: Stackoverflow
Example for block elements are: h1, p, div, ...
Examples for inline elements are: em, block, span, ...
An block element can contain inline elements and text. Some block elements can contain also other block elements (like div) while others cannot (like p). Block elements start a new line in the text flow.
Inline elements can contain other inline elements and text but not block elements. Inline elements do not start a new line in the text flow.
Since <p> is an block element which should not contain other block elements you shouldn't use a <div> inside. Use the <span> here.
You can't use the div there legally. It's a block element. Span is inline.
Comments
Post a Comment