+ 2
What does <span> tag help you do?
Question regarding a tag
5 ответов
+ 6
You may like to style some texts on a line, not the whole line or paragraph. Span is an inline element which let's you do something like this.
HTML :
Hello <span>World</span> !!
CSS :
span {color:red;}
Color of "World" will be red. Not the whole line.
+ 3
Div VS Span:
Span doesn't force a new line.
Example:
⚡️Span⚡️:
<p> Long time ago <span> Apples </span> used to be nice. </p>
Result is: Long time ago Apples used to be nice.
⚡️Div⚡️:
<p> Long time ago <div> Apples </div> used to be nice.</p>
result is: Long time ago
Apples used to be nice.
The span didn't do anything to the text.
But the div started a new line after the word 'ago'.
So you can use Span for styling a specific text....
It might have other usages, but - that's all i know.
ill make u a code Div vs Span, if u need too
+ 1
So you can do inline styles.
+ 1
Thank you Jackson. Does it not help me put a heading? As a background additional information to my question, I'm asking this in HTML.
+ 1
Thanks a lot, Ayan, Ginfio! :)