How span and div tags are different? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How span and div tags are different?

When i draw a circle using <div> it's all ok and when i draw a circle using <span> it's not circle but a rectangle .....why ?

23rd Nov 2020, 2:59 AM
RD:programmer
RD:programmer - avatar
2 Answers
+ 11
Mr. Unknown Div is block element and span is inline element. Block level element can have their own height and width, it is 'not dependent' on the content in that div tag. On the other hand inline elements don't have their own height and width, their height and width is 'dependent' on the content in that span tag. Though you have given height and width to span tag in css but see that it is not working. Also you can change the words between both div and span tag to look at change in height and width. There you will see that changing content in div will not affect on it but changing content in span will definitely affect its height and width. Hope you will understand.
23rd Nov 2020, 3:29 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
0
https://code.sololearn.com/WXninGIk2u7u/?ref=app Here is the code .please check ....
23rd Nov 2020, 3:06 AM
RD:programmer
RD:programmer - avatar