【问题标题】:How to style a reactjs table inside APP.js file如何在 APP.js 文件中设置 reactjs 表的样式
【发布时间】:2022-01-12 15:24:59
【问题描述】:

我有一个问题,您如何在 App.js 中设置 React 项目表的样式?我更喜欢可以直接添加到文件 App.js 中的内容,因为这是一个小型应用程序实践,无需链接到外部 .css。

const StatisticLine =(props) => {
  
  return (
  <div>
    <table>
      <tbody>
        <tr>
          <td>{props.text}</td>
          <td>{props.value}</td>
        </tr>
      </tbody>
    </table>
    
  </div>
)
}

style should be something like this:

【问题讨论】:

    标签: reactjs styles inline-styles


    【解决方案1】:

    您可以通过提供内联样式来设置它们的样式。就像我为下面的第一个元素设置样式一样。

        const StatisticLine =(props) => {
      
      return (
      <div>
        <table>
          <tbody>
            <tr>
              <td style={{fontSize: '20px', fontFamily: 'cursive', color: 'red' }}>{props.text}</td>
              <td>{props.value}</td>
            </tr>
          </tbody>
        </table>
        
      </div>
    )
    }
    

    【讨论】:

      猜你喜欢
      • 2021-07-04
      • 1970-01-01
      • 2021-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-26
      • 1970-01-01
      相关资源
      最近更新 更多