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)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM