2

I have a <div> with the following css properties set via its class:

  • display: inline-block
  • float: left
  • clear: none

But when I see that object on Chrome tool "Computed Style" area, display: inline-block is recognized but is crossed out, and is calculated as "display: block". Why is this happening?

The class name for this <div> is called hbox_elem, and the computed style appears like this:

computed style

I tried Evan's suggestion, and now I get this, but it still does not work:

computed style2

sawa
  • 165,429
  • 45
  • 277
  • 381
  • I just remembered, I've answered this before: http://stackoverflow.com/questions/5854463/jquery-in-chrome-returns-block-instead-of-inline/5854523#5854523 – thirtydot Feb 19 '12 at 17:10

2 Answers2

11

float: left forces display: block for most values of display.

http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo

Otherwise, if 'float' has a value other than 'none', the box is floated and 'display' is set according to the table below.

An extract of the table:

Specified value | Computed value  
--------------------------------
inline-block    | block
thirtydot
  • 224,678
  • 48
  • 389
  • 349
1

Another CSS rule may be overriding it. Try placing !important after inline-block to verify.

div.hbox_elem
{
    display:inline-block !important;
}
Evan Mulawski
  • 54,662
  • 15
  • 117
  • 144