马黑黑 发表于 2022-1-10 17:19

测试表格HTML代码(加CSS修饰再加caption标签):<br>&nbsp;
<style type="text/css">
.tDiv table { margin:0 auto; width:80%; border:1px solid navy; border-collapse:separate; }
.tDiv th { font-weight:bold; border:1px dotted tomato; }
.tDiv td { border: 1px dotted coral; }
.tDiv caption { font-size: 1.4em; font-weight:bold; }
</style>

<div class="tDiv">
<table><tbody>
        </tbody><caption>班级领导名册</caption>
        <tbody><tr><th>序号</th><th>姓名</th><th>职务</th><th>备注</th></tr>
        <tr><td>1</td><td>张三</td><td>班长</td><td>代理</td>
        </tr><tr><td>2</td><td>李四</td><td>副班长</td><td></td>
        </tr><tr><td>3</td><td>张三</td><td>班长</td><td></td>
</tr>
</tbody></table>
</div>

马黑黑 发表于 2022-1-10 17:22

测试表格HTML代码(加CSS修饰再加caption标签):<br>
<style type="text/css">
.tDiv table { margin:0 auto; width:80%; border:1px solid navy; border-collapse:separate; }
.tDiv th { font-weight:bold; border:1px dotted tomato; }
.tDiv td { border: 1px dotted coral; }
.tDiv caption { font-size: 1.4em; font-weight:bold; text-align:center; }
</style>

<div class="tDiv">
<table><tbody>
      </tbody><caption>班级领导名册</caption>
      <tbody><tr><th>序号</th><th>姓名</th><th>职务</th><th>备注</th></tr>
      <tr><td>1</td><td>张三</td><td>班长</td><td>代理</td>
      </tr><tr><td>2</td><td>李四</td><td>副班长</td><td></td>
      </tr><tr><td>3</td><td>张三</td><td>班长</td><td></td>
</tr>
</tbody></table>
</div>

<p><br>理论上,caption应自动居中,编辑时查看效果是居中的,发布后是左对齐。强行设定居中看看效果。</p>
页: 1 2 [3]
查看完整版本: 夜空中最亮的星怎么没出现