0
span and div
https://code.sololearn.com/Wo47bc2sMI92/#html Can someone can explain the diffirent >
2 Answers
0
A DIV is a block element. Just as P is too.
SPAN is an inline element.
Block is like a house to hold chunks of code and elements across a big size on the page.
Inline is like it stays on one line for a sentence or title.
You can put SPANs ( inline elements ) inside DIVs or Ps (block elements), but you usually cannot put block elements inside inline elements.
If you look at your code, you have paragraph (P) block elements inside your SPAN tags (inline).
This is incorrect, because it becomes difficult to style and align using css.
Change it to put the SPANs inside the P tags.