CSS width on inline vs block level elements

Below is an example of an inline element - the span - and a block level element - the div. Both been styled with CSS to have a border and a width of 20em (check the source code). As you can see, you can only use CSS to set the width of a block level element. Setting the width of an inline element has no effect.

test span
test div

Last modified: 20/04/2006 (most likely earlier as a site migration in 2006 reset some dates) Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top