Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 即使是pesudo类也无法正常工作_Css_Reactjs_Tailwind Css - Fatal编程技术网

Css 即使是pesudo类也无法正常工作

Css 即使是pesudo类也无法正常工作,css,reactjs,tailwind-css,Css,Reactjs,Tailwind Css,我的最终目标是创建一个具有不同背景颜色的偶数项的表 从官员那里。我知道我们必须将偶数类添加到循环中调用的子类中。我试着把课程安排在所有可能的地方,但仍然不起作用 <table className="table-fixed shadow-lg"> <thead className="py-2 bg-gray-200"> ...... </thead> <tbody> <tr>

我的最终目标是创建一个具有不同背景颜色的偶数项的表

从官员那里。我知道我们必须将偶数类添加到循环中调用的子类中。我试着把课程安排在所有可能的地方,但仍然不起作用

<table className="table-fixed shadow-lg">
    <thead className="py-2 bg-gray-200">
        ......
   </thead>
   <tbody>
       <tr>
          <td className="px-4 py-2 uppercase text-center font-bold">date</td>
          <td className="px-4 py-2 uppercase text-center font-bold w-100">event</td>
       </tr>
       {eventsData[this.state.currentYear].map(event =>(
           <tr className="even:bg-gray-300">
               <td className="px-4 py-2">{event.date}</td>
               <td className="px-4 py-2">{event.name}</td>
           </tr>
        ))}
    </tbody>
</table>

您的顺风配置文件错误。您需要为
backgroundColor
类启用
偶数
变量。将配置更新为如下所示:

// tailwind.config.js
module.exports = {
  // ...
  variants: {
    backgroundColor: ['even', ...],
  },
}

你把
甚至
类添加到你的顺风配置中了吗?@Redline我很累地添加了它,但它不起作用。我已经用配置更新了问题我已经更新了答案我用这种方式尝试了配置,但仍然不起作用
// tailwind.config.js
module.exports = {
  // ...
  variants: {
    backgroundColor: ['even', ...],
  },
}