Why span elements are used

Describe div elements

25th Jul 2020, 12:12 PM
Sainul Abid
Sainul Abid - avatar
2 Answers
+ 1
Sainul Abid Span is an inline element and is usually used to style some part of text in a para or sentence in a certain way say that you want to highlight or to make it standout. For Ex: I want to make the word 'hello' to have green color, yellow background and a different font size. HTML --------- <p> <span id="hello">Hello</span> This is some text. And here is some other text. </p> --------- CSS --------- #hello{ color: green; background: yellow; font-size: 20px; } --------
25th Jul 2020, 1:30 PM
Hanuma Ukkadapu
Hanuma Ukkadapu - avatar
+ 1
span is inline element that is used to make the element align next to each other unlike div element which starts from new line
25th Jul 2020, 12:15 PM
Abhay - avatar