简体   繁体   English

为什么引导CSS使用box-sizing:border-box?

[英]Why is bootstrap css using box-sizing: border-box?

I'm using only the bootstrap dropdown component but its css shrinked many of my existent layout elements and the page looks now a like damaged. 我仅使用bootstrap下拉组件,但是它的css缩小了许多我现有的布局元素,因此页面看起来像已损坏。 After a closer look I found out what's causing this: 仔细查看后,我发现是什么原因造成的:

*,
*:before,
*:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

Why are they doing this? 他们为什么要这样做?

Remove the global reset border-box from the scaffolding area and in your dropdown css adjust the math OR in the rest of your site adjust for the border-box, so if something had a padding of 10px and a total width of 200px, the old way you'd have 180px as the width, but now just make the width the actual width and the borders are counted. 从脚手架区域中删除全局重置边框,然后在CSS下拉菜单中调整数学,或者在网站的其余部分中调整边框,因此,如果某填充的边框为10px,总宽度为200px,则旧边框您将宽度设置为180px的方式,但是现在只需将宽度设置为实际宽度,然后计算边框。 This is the same for borders too. 边界也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以覆盖box-sizing:border-box? - Is it possible to override box-sizing:border-box? jQuery UI可调整大小,具有框大小:“边框”问题 - Jquery UI Resizable with box-sizing: “border-box” issue 使用box-sizing时,jQuery.height()在WebKit和Firefox中的行为有所不同:border-box - jQuery.height() behaves differently in WebKit and Firefox when using box-sizing:border-box jQuery UI可调整大小的问题与box-sizing:border-box - jQuery UI Reizable sizing issue with box-sizing:border-box INPUT盒子大小的边框,在Chrome内部的TD问题中具有100%的高度和宽度 - INPUT box-sizing border-box with 100% height and width inside TD issue in Chrome JQuery UI Resizable + box-sizing:border-box = height bug? - JQuery UI Resizable + box-sizing: border-box = height bug? 框大小调整:边界框在JS固定位置侧边栏上滚动时导致错误 - Box-sizing: border-box is causing an error on a JS fixed position sidebar, on scroll kendoSplitter内部的窗格不尊重“ box-sizing:border-box”属性 - Panes inside kendoSplitter doesn't respect “box-sizing:border-box” property Firefox忽略box-sizing:border box的padding-bottom - Firefox ignores padding-bottom with box-sizing:border box jQuery .height()无法使用框大小调整:border-border - jQuery .height() not working with box-sizing: border-border
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM