Floating SPANS within DIV
-
I’m working on the next version of my theme NeoBox, and I’ve run into a bit of a styling problem. Here’s what I’m trying to do.
I have a section of the theme that looks something like this (highly simplified):
<div><span class="1">One</span> <span class="2">Two</span> <span class="3">Three</span></div>
As it is, the result looks good — each SPAN is separated by some whitespace and usually a CSS background image. However, I want to improve the layout with a little bit of float magic. However, I have no idea how to do it!
div span { display: block; } div span.2 { float: right; }
That gets me partially there, with the second SPAN floated to the right; unfortunately, it appears on the same line as the third SPAN when I would prefer it to appear on the same line as the first. The second span may have a lot of content requiring line breaks, and its length should not affect SPANs 1 & 3 on the left.
Any ideas?
(I realize I could put SPAN 2 before SPAN 1 and then float it, but that wouldn’t make any semantic sense.)
- The topic ‘Floating SPANS within DIV’ is closed to new replies.