标题带背景图片的表格

栏目: Html · 发布时间: 5年前

核心属性

border-collapse: collapse 表格的边框会合并为一个单一的边框

tr:not(:last-child) 选择除了表格的最后一行

  1. <table id=jaeger-specs>
  2. <caption>机甲规格表</caption>
  3. <thead>
  4. <tr>
  5. <th></th>
  6. <th scope=col>国家
  7. <th scope=col>高度<span> (米)</span>
  8. <th scope=col>重量<span> (吨)</span>
  9. </tr>
  10. </thead>
  11. <tbody>
  12. <tr>
  13. <th scope=row>Gipsy Danger
  14. <td>美国
  15. <td>79
  16. <td>1980
  17. </tr>
  18. <tr>
  19. <th scope=row>Striker Eureka
  20. <td>澳大利亚
  21. <td>76
  22. <td>1850
  23. </tr>
  24. <tr>
  25. <th scope=row>Crimson Typhoon
  26. <td>中国
  27. <td>76
  28. <td>1722
  29. </tr>
  30. <tr>
  31. <th scope=row>Coyote Tango
  32. <td>日本
  33. <td>86
  34. <td>2312
  35. </tr>
  36. <tr>
  37. <th scope=row>Cherno Alpha
  38. <td>俄罗斯
  39. <td>85
  40. <td>2412
  41. </tr>
  42. </tbody>
  43. </table>
  1. #jaeger-specs {
  2. border-collapse: collapse;
  3. margin: 3rem auto;
  4. }
  5. #jaeger-specs caption {
  6. margin-bottom: 2rem;
  7. font-size: 2rem;
  8. font-family: "SimHei", sans-serif;
  9. }
  10. #jaeger-specs td,
  11. #jaeger-specs th {
  12. text-align: center;
  13. padding: 1.5rem;
  14. }
  15. #jaeger-specs th[scope] {
  16. color: #fff;
  17. background-color: #000;
  18. font-weight: normal;
  19. }
  20. #jaeger-specs tbody {
  21. border: 1px solid #222;
  22. }
  23. #jaeger-specs tbody th,
  24. #jaeger-specs tbody th + td {
  25. text-align: left;
  26. font-weight: normal;
  27. }
  28. #jaeger-specs tbody th {
  29. font-size: 1.1rem;
  30. border-right: 1px solid #222;
  31. background-size: cover;
  32. font-family: Agency, Arial, sans-serif;
  33. text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
  34. }
  35. #jaeger-specs tbody tr:nth-child(1) th {
  36. background: url(https://pics.codecolor.cn/responsive-data-grid/gipsy-danger.jpg);
  37. }
  38. #jaeger-specs tbody tr:nth-child(2) th {
  39. background: url(https://pics.codecolor.cn/responsive-data-grid/striker-eureka.jpg);
  40. }
  41. #jaeger-specs tbody tr:nth-child(3) th {
  42. background: url(https://pics.codecolor.cn/responsive-data-grid/crimson-typhoon.jpg);
  43. }
  44. #jaeger-specs tbody tr:nth-child(4) th {
  45. background: url(https://pics.codecolor.cn/responsive-data-grid/coyote-tango.jpg);
  46. }
  47. #jaeger-specs tbody tr:nth-child(5) th {
  48. background: url(https://pics.codecolor.cn/responsive-data-grid/cherno-alpha.jpg);
  49. }
  50. #jaeger-specs tbody tr:not(:last-child) {
  51. border-bottom: 1px solid #222;
  52. }
  53. #jaeger-specs thead th[scope] {
  54. border: 1px solid #222;
  55. border-bottom: none;
  56. }
  57. #jaeger-specs tbody td:not(:last-child) {
  58. border-right: 1px solid #222;
  59. }
  60. #jaeger-specs tbody td {
  61. background: hsl(195, 100%, 20%);
  62. color: #fff;
  63. }

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Sovereign Individual

The Sovereign Individual

James Dale Davidson、William Rees-Mogg / Free Press / 1999-08-26 / USD 16.00

Two renowned investment advisors and authors of the bestseller The Great Reckoning bring to light both currents of disaster and the potential for prosperity and renewal in the face of radical changes ......一起来看看 《The Sovereign Individual》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换