markdown 表格宽度调整

先在浏览器中看看  HTML 是怎样的:
< table > < thead > < tr > < th > 名称 </ th > < th ></ th > < th > 备注 </ th > </ tr > </ thead > < tbody > <!-- 省略 tbody 内容 --> </ tbody > </ table >
利用浏览器上的开发者工具我们可以调试一下,把【名称】左边的  <th>  改为:
< th style = "width: 100px;" >
  • 1
  看起来似乎不错。回到  Markdown  上,在原表格前添加 CSS 代码,类似这样:
< style > table th:first-of-type { width: 100px; } </ style > <!-- 下方是表格的 Markdown 语法 --!>
首先  <th>  存在于  <table>  中;其次  th:first-of-type  的意思是每个  <th>  为其父级的第一个元素,这里指的就是围绕着【名称】的  <th> 。同理第二、三个使用  th:nth-of-type(2) th:nth-of-type(3)  就可以了,以此类推。 
  上述的  th:first-of-type  等于  th:nth-of-type(1)

转载于:https://www.cnblogs.com/elesos/p/9016239.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值