Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing inherited property of an element (box-sizing)

I am using a jQuery light box plugin on a bootstrap site. It has box-sizing: border-box set via universal selector.

* {     -moz-box-sizing: border-box;     -webkit-box-sizing: border-box;     box-sizing: border-box; } 

The light box div does not appear right because of this (sometimes a vertical scrollbar appears). Once we remove this through web inspector it appears ok. Is there any way to remove the box-sizing property of this particular element. box-sizing:'' or box-sizing:none does not appear to work.

like image 677
Gokul Kav Avatar asked Oct 12 '12 17:10

Gokul Kav


People also ask

Is box-sizing inherited?

One potential gripe with it is that box-sizing isn't normally inherited, so it's specialized behavior, not quite the same as something you'd normally put in a reset.

What does box-sizing inherit mean CSS?

The box-sizing property defines how the width and height of an element are calculated: should they include padding and borders, or not.

What does box-sizing border-box do to an element?

border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. If you set an element's width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width.

What is the purpose of the box-sizing property What are it's possible values?

With the CSS box-sizing Property The box-sizing property allows us to include the padding and border in an element's total width and height. If you set box-sizing: border-box; on an element, padding and border are included in the width and height: Both divs are the same size now!


2 Answers

The box-sizingmsdn, mdn CSS property default is box-sizing: content-box;. Have you tried to use it to override the inherited style?

like image 194
VKen Avatar answered Oct 14 '22 06:10

VKen


you can use

*:not(.classname){   box-sizing : border-box; } 

classname will be the class of element you want to exclude from the universal selector.

like image 33
user5371360 Avatar answered Oct 14 '22 06:10

user5371360