+ 1

Isn't <div> and <span> the same thing since they can be used for the same purpose?

14th Jul 2020, 8:24 PM
Great
Great - avatar
4 Answers
+ 6
Div is a block level element Span is an inline element
14th Jul 2020, 8:33 PM
Namit Jain
Namit Jain - avatar
14th Jul 2020, 8:28 PM
Hardik Sharma
Hardik Sharma - avatar
+ 5
Span should be used to decorate inline content, for example, if you want to decorate a word inside a paragraph, you write: <p> this is a <span class="example">paragraph</span>· </p> You then use CSS to decorate this word. Div is used to decorate block elements, for example, if you wanted to decorate two paragraphs, you would write: <div class="example"> <p> bluh bluh bluh </p> <p> bluh bluh bluh </p> </div>
14th Jul 2020, 8:38 PM
Karak10
Karak10 - avatar
+ 1
Thank you guys
14th Jul 2020, 10:51 PM
Great
Great - avatar