0
Why span elements are used
Describe div elements
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;
}
--------
+ 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