css - 如何添加盒子大小: border-box to all HTML elements using TailwindCSS

标签 css tailwind-css

TailwindCSS 中的等效项是什么?

* {
  box-sizing: border-box;
}

最佳答案

Tailwind 在 preflight 中已经有了这样的样式- 请参阅编译stylesheet .

/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
*/

*,
::before,
::after {
  box-sizing: border-box; /* 1 */
}

因此,除非您禁用了预检,否则无需添加它。

但是,Tailwind 的等效类名称将为 border-box - 请参阅 here

关于css - 如何添加盒子大小: border-box to all HTML elements using TailwindCSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73786814/

相关文章:

javascript - 不正确的 jQuery 元素宽度计算

html - 仅第一个直接子级的 css

html - div 标记左侧的意外空间

javascript - 如何在获得焦点时使用 javascript 设置(这个)输入元素的样式

reactjs - 类型错误 : Cannot read property 'theme' of undefined at runMicrotasks

Next.JS -> 提供了一个 null PostCSS 插件

html - 使用 CSS 显示箭头

css - Tailwind CSS 中的网格元素同时增长

css - 侧边栏旁边有 3 个网格布局