Skip to Content
Delete Icon
This forum is now read-only. Please use our new forums at discuss.codecademy.com.
0 points
Submitted by Nicholas Pryor
8 years ago

What does the span tag do?

Can you explain the span tag to me in a little more information?

Answer 502ad79ab78f680002029ca4

4 votes
Best answer

Permalink

The span tag is like the div tag. It has no meaning at all and is mostly used for styling by using an id or class. The difference between the two is that div is a block element, It’s on a seperate line. span however is an inline element, meaning that it can be on a line with other elements.

Example: span

<span>I will display inline next to the b tag</span><b>I will display next to the span tag</b>

div

<div>I will display as a block element on my own line, above the b tag</div><b>I will display beneath the div tag</b>

You could style them using id’s or classes like this:

html

<span id="changeColor">I'm gonna change!</span>

css

#changeColor {
        color:red;   
}

That’s about it. Hope this helped, just ask if you have more questions.

4012 points
Submitted by Nico Ekkart
8 years ago

2 comments

Nicholas Pryor 8 years ago

Thank you so much. You had not only answer my question but also added alot of details I didn’t even ask for. Thank you once again.

Nico Ekkart 8 years ago

You welcome