Why are these 2 CSS SPANs not ligning on same line!


As you know SPANs are supposed to by default line up on the same line.
So we have 2 SPANs that are not doing this! And we have tried everything for these 2 SPANs to be on the same line and not have a break line, but they keep having a break line and being on 2 lines.
You can see the test page here:


And the 2 SPANs have the ids:

with innerHTML of:

My Note

  • I have Posted 3 Notes to date

BTW, we have some Tables in this page, So for those pure CSS guys, please put that aside
and if you can just tell us why in GODs name these 2 SPANs are not aligning up on same line?


That’s what display block does.

<span class="notes_back" id="notes_count" style="display: block;"> 
							- I have Posted <span id="post_val">3</span> Notes to date

And the invalid HTML can’t be helping any



Do you mean that if you have a <span> tag and give it {display:block} it will behave like a “block” element such as a paragraph or div???

Who wouldda thought. :thinking:

Ah so these 2 SPANs are Displaying on 2 different lines because of display: block; in the 2nd SPAN!
Ayayayay :frowning:
FYI, we have the display: block; is in the 2nd SPAN because at times this display is set to none, so that that SPAN does not display at all. But no problem, we will get around that via Php coding not to display that SPAN at designated times.
Just real blown away that display: block; was behind this multi line display of these SPANs!

Curious: is there a CSS code that will display 2 SPANs in same line even IF one of them has display: block;?


Perhaps what you are looking for is display: inline-block.

Or if you simply want to revert from display: none to normal span behaviour, display: inline.


Yes, a fix to get all those spans in the same row, one that does not require any changes in the scripts, only to the “style_new.css” after the ruleblock on line 226:

/* add the below ruleblock */
    float: left; /* let following elements flow adjacent */
    margin-right: .4em; /* to simulate a space character */
    line-height: 22px; /* to level the children */

This will work also when the block span is not displayed. Guessing a javascript sets the inline style.

You should probably remove the <br> tag after the spans.

Ok, Thanks.

Thanks U2.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.