How does one use <div/> and <span/> in HTML5 and what is its function. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does one use <div/> and <span/> in HTML5 and what is its function.

21st Apr 2020, 7:34 PM
GA Brainee
4 Answers
+ 3
Thanks guys
21st Apr 2020, 7:50 PM
GA Brainee
+ 2
You use it to group elemets, it gets useful when working with CSS and classes. Using <div> makes a new block, <span> just groups it together.
21st Apr 2020, 7:37 PM
Fabian H
Fabian H - avatar
+ 1
Div and span are used for kind of same reason.But div is block element.And span is inline element.
21st Apr 2020, 7:45 PM
Samira
Samira - avatar
0
HTML5 Sectioning elements should be used instead of <div> and if at all a <div> is used, ARIA role attributes should be provided. https://www.sololearn.com/learn/HTML/2191/ https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles That been said, <div> is used for block-level sectioning while <span> is used for <inline> grouping https://www.sololearn.com/Discuss/1287933/?ref=app
21st Apr 2020, 7:43 PM
Ore
Ore - avatar