【发布时间】:2020-08-28 13:36:07
【问题描述】:
样式或 CSS 不是最好的...试图让 React Bootstrap 表以相等的列宽填充页面,使用了宽度为 200% 的样式化 div,但它似乎不正确(参见图片)。
最终,我可能希望将单独的组件放入<td>,但那是以后的事情了。
不太确定如何在此处设置表格样式...
import React from "react";
import styled from "styled-components";
import { Table } from "react-bootstrap";
const GridWrapper = styled.div`
display: grid;
grid-gap: 10px;
margin-top: 4.5em;
margin-left: 6em;
margin-right: 6em;
grid-template-columns: repeat(12, 1fr);
grid-auto-rows: minmax(25px, auto);
`;
const TableWrapper = styled.div`
width: 200%;
`;
export const Reports = props => (
<GridWrapper>
<div>
<TableWrapper>
<ReportsTable />
</TableWrapper>
</div>
</GridWrapper>
);
function ReportsTable() {
return (
<Table striped bordered hover size="sm" hover>
<table>
<tr>
<th>Sim Id</th>
<th>Run Date</th>
<th>Run By</th>
<th>Duration</th>
<th>Sim Title</th>
<th>Sim Count</th>
<th>Sim End Date</th>
<th>Status</th>
<th>Info</th>
<th>JSON</th>
<th>Report</th>
</tr>
<tr>
<td>A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
<td>col A</td>
</tr>
</table>
</Table>
);
}
【问题讨论】:
标签: javascript html css reactjs react-bootstrap