【发布时间】:2019-06-14 15:36:43
【问题描述】:
<div className="table-responsive">
<table className="table table-hover" id="job-table">
<thead>
<tr className="text-center">
<th scope="col">Sr.No.</th>
<th scope="col">Company Name</th>
<th scope="col">Technology</th>
<th scope="col">Total Resumes</th>
<th scope="col">Job Title</th>
<th scope="col">Total Score</th>
<th scope="col">Average Score</th>
</tr>
</thead>
<tbody className="text-center">
{this.props.list && this.props.list.content && this.props.list.content.length > 0 && this.props.list.content.map((item, key) => {
return (
<tr key={key}>
<td className="font-weight-bold">1</td>
<td className="font-weight-bold">ABCDED</td>
<td>Software Developer</td>
<td className="font-weight-bold">17</td>
<td>5 years experience</td>
<td className="font-weight-bold">30</td>
<td className="font-weight-bold">30</td>
</tr>
)
})}
</tbody>
</table>
</div>
在此我使用了table-responsive class。我试图通过使用这个来使这个表可以滚动:
tbody { height: 400px; overflow-y: scroll }
但这不起作用。
关于td 内容的另一件事是,如果它很大,其他行会受到影响。如何避免这种情况?
【问题讨论】:
-
这个 codepen 比这里发布的答案更接近解决问题:codepen.io/bobmarksie/pen/VadxoK
标签: javascript html css reactjs bootstrap-4