+ 1

Why we use span in html? What is padding? Difference between span and div

26th Jan 2017, 4:33 PM
Amith Raj
Amith Raj - avatar
2 Answers
+ 3
Span is inline element , div is not inline element.Try to use more div elements , and not so much span elements.Padding is distance between some elements in html.One example: If you have div with text inside , the padding will do it distance between div border and text.Just try it you will understand what i am explain you.It is not so difficuilt.
26th Jan 2017, 5:23 PM
Живко Желев
Живко Желев - avatar
+ 3
okay let me try to answer your question. I think there are two types of elements. inline and block elements. Block elements act like a box. It adds paragraph spaces at the beginning and at the end. like the <p> element. Inline elements flow inside of elements and dont get paragraph spaces like the block element. Padding is the spacing around the content of your element. You really need an understanding of the "box model'. The span is useful for styling inline elements with an external css. A div is a generic block element and can be useful for dividing up your code in html. ok i tried my best to answer your question, good luck and happy coding. lol
26th Jan 2017, 6:11 PM
Dwain Aiolupotea
Dwain Aiolupotea - avatar