14

I'm wondering if that (my title) is ever incorrect, other than for HTML validation. I've recently had to start supporting IE7 again (I've been lucky enough to not have to for the past 3 years or so) and the fact that div's can't be inline-block has gotten me about 10 times in the past month due to the fact that I make everything a div by default and then go back and stylize elements. So I'm considering making everything a span so that if I later go back and make something inline-block I'm not trying to figure out why it's not working in IE7.

So my question -- Is there ever a case, in any browser (IE7+, FF, Webkit, Opera), that anyone knows of where a span can not act like a div? I'm not concerned about the HTML not validating due to having block elements inside inline ones.

Dharman
  • 30,962
  • 25
  • 85
  • 135

2 Answers2

11

I'm not going to directly answer your question, but I think this is worth saying.

I've recently had to start supporting IE7 again (I've been lucky enough to not have to for the past 3 years or so) and the fact that div's can't be inline-block has gotten me about 10 times in the past month

You can use display: inline-block in IE7 for block-level elements such as divs, with:

selector {
    display: inline-block;
    *display: inline;
    zoom: 1
}

If you don't want to use an invalid but safe CSS hack (*property), you can use conditional comments.

thirtydot
  • 224,678
  • 48
  • 389
  • 349
  • huh... Thanks :) I actually always have a browser tag on the ``, so usually do stuff like `.IE7 .selector` instead of css hacks. –  Jul 07 '11 at 18:04
0

This may be of help: SPAN vs DIV (inline-block)

Community
  • 1
  • 1
anjunatl
  • 1,027
  • 2
  • 11
  • 24
  • Thanks, but it doesn't. It simply states what I already know, that you can set `inline-block`, `block`, `inline` on the various elements to change their behavior. I'm more looking for an answer to: "Is `
    ...
    ` ever different than `...`". Sorry for the confusion
    –  Jul 07 '11 at 17:55