【问题标题】:Cannot use table classname when using Bootstrap/React Bootstrap in ReactJs在 ReactJs 中使用 Bootstrap/React Bootstrap 时无法使用表类名
【发布时间】:2017-11-19 19:22:54
【问题描述】:

我想在我的 ReactJs-Spring 项目中包含 react-bootstrap 主题。

我已根据其网站上的教程链接资源,如下所示:

<script src="https://unpkg.com/react@latest/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap/0.31.0/react-bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />

我这样对表格元素进行编码:

<table className="table table-striped">                         
   <tr>
     <th>Name</th>
     <th>Age</th>
     <th>Years</th>
     <th>Delete</th>
   </tr>                           
</table>

但在网站上,它没有任何变化:

谁能帮我解决这个问题?谢谢

【问题讨论】:

    标签: reactjs spring-boot bootstrap-4


    【解决方案1】:

    尝试添加theadtbody 元素,例如:

    <table className="table table-striped">
      <thead>            
        <tr>
          <th>Name</th>
          <th>Age</th>
          <th>Years</th>
          <th>Delete</th>
        </tr>    
      </thead>  
      <tbody>
        ...
      </tbody>                       
    </table>
    

    【讨论】:

      猜你喜欢
      • 2017-04-08
      • 2015-11-08
      • 2020-10-05
      • 2022-05-12
      • 2020-05-11
      • 2021-10-24
      • 2017-12-29
      • 2019-09-11
      • 2017-08-19
      相关资源
      最近更新 更多