无法在 Tailwind 上扩展间距

问题描述

我正在尝试扩展 Tailwind 上的间距,但无法使其正常工作。我进行了研究并在 tailwind.config.js 中进行了更改,但是当我在 HTML 中使用该类时,它不存在。

PS:我知道没有必要运行构建

tailwind.config.js

module.exports = {
  purge: [],darkMode: false,// or 'media' or 'class'
  theme: {
    extend: {
      spacing: {
        '1/3': '33,333333%','2/3': '66,666667%'
      }
    },},variants: {
    extend: {},plugins: [],}

解决方法

我刚刚检查了您的配置,它确实创建了所有类。问题在于 Protocol_A_Or_B33,333333% 不是有效的 CSS 值。

与西班牙语不同,您必须使用小数点,而不是逗号:

66,666667%

theme: { extend: { spacing: { '1/3': '33.333333%','2/3': '66.666667%',}, 是无效的属性值:

enter image description here

33,333333% 工作正常:

enter image description here

Codesandbox link

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...