Can a span have a width?

Yes. Since a span tag is an inline element and it has “display:inline” as default, it doesn’t naturally have a width.

If you want to apply a width to a span you’ll have to change the display property to either inline-block & inline (for ie) and then add a width.

span { display:inline-block; width:200px; }
*html span { display:inline; }

Adding a float to the span also changes the display property so you can set a width that way too.

span { float:left; width:200px; }

Back to Blog

Say Hello

You can reach me by email, I'd love to hear from you.