WPDIR
Everything and everyone WordPress

What does * { box-sizing: border-box; } do and should I use it?

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #806 Reply
    Keith
    Guest

    This CSS snippet been floating around for 10 years already, do you guys still use it or not

    #807 Reply
    Doris
    Guest

    I still use it in my WordPress themes… my big question is why don’t the major browsers support this by default already?

    https://dev.to/anewman15/what-does-box-sizing-border-box-do-what-are-its-advantages-1nbb

    #808 Reply
    Julia
    Guest

    Paul Irish blogged about this in 2012… dinosaur years and still a struggle.

    https://paulirish.com/2012/box-sizing-border-box-ftw/

    #809 Reply
    Alan
    Guest

    what does it do?? I don’t get it

    #810 Reply
    Carolyn
    Guest

    another thread

    https://stackoverflow.com/questions/66225760/can-i-use-box-sizing-border-box-in-universal-selector-every-time

    If you start a new project it might be ok and clean to add * { box sizing: border-box; } at the beginning so you can use it on the entire project and everyone else developing on the project will see it.

    BUT if you work on an existing project and then just add * { box sizing: border-box; } somewhere could mess up the entire layout! So there it might be “safer” to only add it to the containers you are working on with something like .border-boxed-container * { box sizing: border-box; }. Or have an extra class like "border-boxed" which you can add to every element accordingly the CSS .border-boxed { box sizing: border-box; }

    #847 Reply
    Jennifer
    Guest

    Yes, you can use it 😀

    #882 Reply
    Ann
    Guest

    Chrome should just automatically do this by default!

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: What does * { box-sizing: border-box; } do and should I use it?