tags:

views:

52

answers:

3

I would like to add some CSS fixed size blocks inline into a text paragraph and I'm having cross browser issues. I use div and inline-block and it works on Firefox. Under IE it fails (inline-blocks aren't fully supported).

Is there a simple cross browser solution available?

(The rationale for this is for the fixed size blocks to use background-image for the displaying of smileys. This allows sprites and smileys shown according to the stylesheet.)

+3  A: 

What element are you applying inline-block on?

IE 6/7 accepts the value only on elements with a natural display: inline.

So if you're using a div right now, switch to a spaninstead.

Guillaume Flandre
@The Feast: Even more, you seem to suggest you're using divs inside a paragraph tag. That's illegal HTML (a `p` can't contain block-level elements), so you should be using a span there anyway.
mercator
Don't forget to use `-moz-inline-box` for older versions of Firefox.
DisgruntledGoat
Thanks - that's done the trick. I'm sure I tried this amongst many things with no success - but some other factor prevented it. @mercator, thanks, I wasn't using a div inside an HTML `p` paragraph, it was compliant XHTML strict.
Pool
A: 

In IE, to get inline-block behavior, you set it to display: inline and give it 'hasLayout' via one of the methods (zoom: 1 is a common way).

DA
A: 

Use a <span> inside your <p>. It's inline to begin with.

You can't put block elements inside a <p>. That's invalid code!

That should solve it.

Jonny Haynes