【问题标题】:TailwindCSS overflow-auto class not working with React ListsTailwindCSS 溢出自动类不适用于 React 列表
【发布时间】:2021-08-11 04:11:00
【问题描述】:

我遇到了 Tailwind 的溢出属性不适用于反应列表的问题。我想知道这只是我的一个简单错误,还是我需要做一些解决方法。

Image to It Not Working

import CoinSummary from './CoinSummary'

const Holdings = ({ coins }) => {
  return (
    <div className='overflow-auto p-4'>
      <h2 className='text-2xl text-center font-bold mt-4'>Holdings</h2>
      {coins &&
        coins.map((coin, index) => {
          return <CoinSummary key={index} coin={coin} />
        })}
    </div>
  )
}

export default Holdings

我希望硬币列表保留在 Holdings 组件内,如果溢出,则改为使用滚动条。但是,正如您在照片中看到的那样,它似乎并没有像我预期的那样工作。

【问题讨论】:

    标签: javascript html css reactjs tailwind-css


    【解决方案1】:

    我能够自己解决。那是因为我没有指定高度是h​​-full

    【讨论】:

      猜你喜欢
      • 2022-11-30
      • 1970-01-01
      • 2022-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-10
      • 2013-09-10
      相关资源
      最近更新 更多