Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculated style forced into something else

Tags:

html

css

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

like image 422
sawa Avatar asked Apr 14 '26 23:04

sawa


2 Answers

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
like image 163
thirtydot Avatar answered Apr 16 '26 15:04

thirtydot


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

div.hbox_elem
{
    display:inline-block !important;
}
like image 21
Evan Mulawski Avatar answered Apr 16 '26 17:04

Evan Mulawski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!