Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use in global box-sizing:border-box in my project? [closed]

Can I use in my all murkup (all project ) box-sizing: border-box;?

for example:

html { 
   box-sizing: border-box; 
}, 
:before, *:after {
  box-sizing: inherit; 
}

Because it is easier to count the real width, but are there any downsides to this approach?

like image 219
Limarenko Denis Avatar asked Oct 18 '25 14:10

Limarenko Denis


1 Answers

I generally apply it to everything. Use:

html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

It makes everything a lot easier and is widely supported.

https://css-tricks.com/international-box-sizing-awareness-day/

http://www.paulirish.com/2012/box-sizing-border-box-ftw/


It's also worth noting that the CSS working group consider this a mistake in the design of CSS:

Box-sizing should be border-box by default.

https://wiki.csswg.org/ideas/mistakes

like image 187
JamieC Avatar answered Oct 20 '25 05:10

JamieC



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!