span and div | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок

span and div Can someone can explain the diffirent >

25th Oct 2019, 5:51 AM
Ryuunosuke Akasaka
Ryuunosuke Akasaka - avatar
1 ответ
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.
25th Oct 2019, 8:16 AM
Xyenia 🦉
Xyenia 🦉 - avatar