【发布时间】:2020-10-18 22:38:10
【问题描述】:
我在 readthedocs 上托管的第一个文件中有一个表格,我想从中删除边框。麻烦的是,我在 CSS 文件中尝试的任何方法似乎都不起作用。我已经查看了其他几个解决方案,但还没有成功。
这是 rst 中表格的(缩短的)示例(请注意,我已拆分最后三行中的列以创建嵌套效果,不确定这是否会导致任何并发症)。
+------------------+-----------------------------+------------+-------------------------------------+
| Parameter | Description | Type | Notes |
+==================+=============================+============+=====================================+
| patrolID | ID of the submitted patrol. | int | Assigned automatically by the patrol|
| | | | app. |
+------------------+-----------------------------+------------+-------------------------------------+
| date | Date the patrol | string | Format is YYYY-MM-DD. |
| | occurred. | | |
+------------------+-----------------------------+------------+-------------------------------------+
| userID | The alias of the individual | string | Matches the user’s Vanguard email |
| | who submitted the patrol. | | alias (For example, MScott). |
+------------------+-----------------------------+------------+-------------------------------------+
| patrolStart | Time the patrol started. | int | Format is 24-hour (Ex: 0700 |
| | | | or 1400). |
+------------------+-----------------------------+------------+-------------------------------------+
| patrolEnd | Time the patrol ended. | int | Format is 24-hour (Ex: 0700 |
| | | | or 1400). |
+------------------+-----------------------------+------------+-------------------------------------+
|perimeterFence | Patrol area. | object | |
+----+-------------+-----------------------------+------------+-------------------------------------+
| |time | Time the area was patrolled.| int | Format is 24-hour (Ex: 0700 |
| | | | | or 1400). |
+----+-------------+-----------------------------+------------+-------------------------------------+
| |incident | Indicates whether anything | boolean | Default value is false. |
| | | unusual was encountered | | |
| | | during the patrol. | | |
+----+-------------+-----------------------------+------------+-------------------------------------+
| |details | Summary of area patrol. | string | When incident is false, the default |
| | | | | value will be "Nothing to report." |
+----+-------------+-----------------------------+------------+-------------------------------------+
表格在 readthedocs 上的外观截图:
表格的 HTML 代码(我无法使用 RTD 更改类名或元素,所以所见即所得)
<div class="section" id="submit-a-patrol">
<h2><a class="toc-backref" href="#id1">Submit a patrol</a><a class="headerlink" href="#submit-a-patrol" title="Permalink to this headline">¶</a></h2>
<p>URL: POST <a class="reference external" href="https://api.vanguard.com/patrol">https://api.vanguard.com/patrol</a>/{PatrolID}</p>
<p>Adds a patrol report. A successful response requires all listed parameters be included with appropriate values.</p>
<table border="1" class="docutils">
<colgroup>
<col width="4%" />
<col width="14%" />
<col width="31%" />
<col width="13%" />
<col width="39%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head" colspan="2">Parameter</th>
<th class="head">Description</th>
<th class="head">Type</th>
<th class="head">Notes</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td colspan="2">patrolID</td>
<td>ID of the submitted patrol.</td>
<td>int</td>
<td>Assigned automatically by the patrol
app.</td>
</tr>
<tr class="row-odd"><td colspan="2">date</td>
<td>Date the patrol
occurred.</td>
<td>string</td>
<td>Format is YYYY-MM-DD.</td>
</tr>
<tr class="row-even"><td colspan="2">userID</td>
<td>The alias of the individual
who submitted the patrol.</td>
<td>string</td>
<td>Matches the user’s Vanguard email
alias (For example, MScott).</td>
</tr>
<tr class="row-odd"><td colspan="2">patrolStart</td>
<td>Time the patrol started.</td>
<td>int</td>
<td>Format is 24-hour (Ex: 0700
or 1400).</td>
</tr>
<tr class="row-even"><td colspan="2">patrolEnd</td>
<td>Time the patrol ended.</td>
<td>int</td>
<td>Format is 24-hour (Ex: 0700
or 1400).</td>
</tr>
<tr class="row-odd"><td colspan="2">perimeterFence</td>
<td>Patrol area.</td>
<td>object</td>
<td> </td>
</tr>
<tr class="row-even"><td> </td>
<td>time</td>
<td>Time the area was patrolled.</td>
<td>int</td>
<td>Format is 24-hour (Ex: 0700
or 1400).</td>
</tr>
<tr class="row-odd"><td> </td>
<td>incident</td>
<td>Indicates whether anything
unusual was encountered
during the patrol.</td>
<td>boolean</td>
<td>Default value is false.</td>
</tr>
<tr class="row-even"><td> </td>
<td>details</td>
<td>Summary of area patrol.</td>
<td>string</td>
<td>When incident is false, the default
value will be “Nothing to report.”</td>
</tr>
<tr class="row-odd"><td colspan="2">facilityExterior</td>
<td>Patrol area.</td>
<td>object</td>
<td> </td>
</tr>
<tr class="row-even"><td> </td>
<td>time</td>
<td>Time the area was patrolled.</td>
<td>int</td>
<td>Format is 24-hour (Ex: 0700
or 1400).</td>
</tr>
<tr class="row-odd"><td> </td>
<td>incident</td>
<td>Indicates whether anything
unusual was encountered
during the patrol.</td>
<td>boolean</td>
<td>Default value is false.</td>
</tr>
<tr class="row-even"><td> </td>
<td>details</td>
<td>Summary of area patrol.</td>
<td>string</td>
<td>When incident is false, the default
value will be “Nothing to report.”</td>
</tr>
<tr class="row-odd"><td colspan="2">facilityInterior</td>
<td>Patrol area.</td>
<td>object</td>
<td> </td>
</tr>
<tr class="row-even"><td> </td>
<td>time</td>
<td>Time the area was patrolled.</td>
<td>int</td>
<td>Format is 24-hour (Ex: 0700
or 1400).</td>
</tr>
<tr class="row-odd"><td> </td>
<td>incident</td>
<td>Indicates whether anything
unusual was encountered
during the patrol.</td>
<td>boolean</td>
<td>Default value is false.</td>
</tr>
<tr class="row-even"><td> </td>
<td>details</td>
<td>Summary of area patrol.</td>
<td>string</td>
<td>When incident is false, the default
value will be “Nothing to report.”</td>
</tr>
</tbody>
</table>
<p><strong>Responses</strong></p>
<table border="1" class="docutils">
<colgroup>
<col width="21%" />
<col width="79%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Code</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>200</td>
<td>Successful operation.</td>
</tr>
</tbody>
</table>
终于有了我目前拥有的 CSS。
div.section table, td
{
white-space: normal !important;
}
div.section tbody, tr, td
{
border: none;
}
div.section thead, th
{
color: #FFFFFF;
background-color: #4472C4;
}
div.section tr.row-odd
{
background-color: #D9E2F3;
}
我尝试过定位 table、tbody、.docutils 和其他排列,但无法做任何事情来影响边框,尽管所有其他 CSS 条目都做了它们应该做的事情。欢迎任何想法。
【问题讨论】:
标签: html css restructuredtext read-the-docs