What is <div> and <span> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is <div> and <span>

25th Jul 2019, 5:40 PM
ADVIPER
ADVIPER - avatar
6 Answers
+ 5
<span> inline element (affect single line) 👇Lines( Example ) 1. 2. <span> hello </span> 3. ______________________________ <div> Block element (affect multiple lines) Example: 1. <div> 2. Hello 3. I love 4. Sololearn 5. </div> note: you can use <span> inside <div> ,but you can't use <div> inside <span>
25th Jul 2019, 6:54 PM
KingDaniel2004
KingDaniel2004 - avatar
+ 4
Div is an block element. You can use it to slice your html code into smaller pieces, and stylish them. span is an inline element and you can use it to stylish something inside an element (like a paragraph) <p>Hello<span style=color:red;> there</span></p>
25th Jul 2019, 6:44 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
0
<div> automatically adds a line bread in but <span> does not
25th Jul 2019, 7:47 PM
coffeecup
coffeecup - avatar
0
Line break not line bread
25th Jul 2019, 7:48 PM
coffeecup
coffeecup - avatar
0
Thanks all
26th Jul 2019, 2:42 AM
ADVIPER
ADVIPER - avatar
- 1
div its a block
25th Jul 2019, 5:54 PM
Jojo