html - 表格标题和正文布局
问题描述
我的表格标题和表格正文内容都以 html 形式输入,但表格正文的内容仅显示在网页上的一个标题上。如何解决此问题,以使正文内容位于正确的标题下?这是我的代码。
<thead>
<th>Nursery</th>
<th>Life Kids</th>
<th>Thrive Youth</th>
<th>Adult Bible Study</th>
</thead>
<tbody>
<tr>
<td>Ages 0-Preschool<br>Availiable during all services</td>
</tr>
<tr>
<td>K-5th Grade<br>Sundays @10am & Wednesdays @6:30pm</td>
</tr>
<tr>
<td>6th-12th Grade<br>Wednesdays @6:30pm</td>
</tr>
<tr>
<td>Adults<br>Wednesdays @6:30pm</td>
</tr>
</tbody>
解决方案
您的代码的固定版本:
<table>
<tr>
<th>Nursery</th>
<th>Life Kids</th>
<th>Thrive Youth</th>
<th>Adult Bible Study</th>
</tr>
<tr>
<td>Ages 0-Preschool<br>Availiable during all services</td>
<td>K-5th Grade<br>Sundays @10am & Wednesdays @6:30pm</td>
<td>6th-12th Grade<br>Wednesdays @6:30pm</td>
<td>Adults<br>Wednesdays @6:30pm</td>
</tr>
</table>
您可以使用以下 CSS 代码对其进行样式设置:
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
推荐阅读
- c# - 如何在 C# 中从 XML 文件中检索属性
- haskell - Haskell奇怪的(对我来说)行为
- python - 在Tensorflow中按字符串选择不同的模式
- java - Spring Boot 中的 Sendgrid 解析 api
- python - 重命名dask数据框中的列
- branch.io - 快速链接的 Branch.io 自定义事件计数不会增加
- spring - 为什么默认配置的spring webflux中没有异常堆栈跟踪?
- laravel - 在 Laravel 响应中按升序对 JSON 对象数组进行排序
- javascript - 数据表列未右对齐
- vb.net - 如何使用 SQL 在报表查看器中添加图像