Using box-sizing : border-box with Twitter Bootstrap 2.x, can we do it easily without breaking everything?

后端 未结 2 600
轮回少年
轮回少年 2020-12-30 09:40

I have been using the \"border-box box model\" in my last projects. This has a lot of advantages that I won\'t explain here. But you can read about it here: Border-box in cs

2条回答
  •  星月不相逢
    2020-12-30 09:57

    Yes.

    Here's a mixin you can use in Bootstrap. It will automatically add all the vendor prefixes.

    *, *:before, *:after {
        .box-sizing(border-box);
    }
    
    input {
        .box-sizing(content-box);
    }
    

    Inputs still need the content-box, otherwise they'll be too small.

提交回复
热议问题