PDA

View Full Version : Spans and Width


dembonez
01-22-2006, 08:49 PM
I have just recently gotten back into web development and what I know is pretty antiquated, pretty much I am learning xhtml and css to get out of the habit of using tables for everything.

My question is this. When working with my style sheet I try and set, for this problem, a spans width and height but no matter what I do it clips itself down to the actual length of the content inside of the span instead of using the width and height I gave it through an ID or class (tried both). Is there anyway to work around this?

If you need code examples let me know. The page I am designing has no purpose then to play with css and xhtml.

Lerura
01-22-2006, 09:02 PM
a <span>'s only purpose is to enable character formatting.
therefore it cannot be uses as a container.

use <div>'s instead

mark87
01-22-2006, 09:05 PM
A span is an inline element so you can't give it a set width.

Only way is to set it to display:block. Alternatively you could give it left and right margins.

dembonez
01-22-2006, 09:10 PM
Thanks guys. On that note is it possible to make divs inline like you can with lists?

dembonez
01-22-2006, 09:20 PM
Got it figured out. Thanks again.

mark87
01-22-2006, 09:32 PM
What did you do in the end? :)

dembonez
01-22-2006, 09:45 PM
I messed with the div margins to only effect the divs inside of an ID I made. So they dont have that huge space they put in between. They are not inline but works to my liking this way too.

Now I just have to figure out how to get firefox to push text in when I use right padding instead of making the box bigger if the style has text right-aligned.