标题带背景图片的表格

栏目: 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. }

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

查看所有标签

猜你喜欢:

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

创新者

创新者

[美] 沃尔特 · 艾萨克森 / 关嘉伟、牛小婧 / 中信出版社 / 2016-6 / 88.00

讲述了计算机和互联网从无到有的发展历程,并为我们生动地刻画出数字时代的创新者群像。 在近200年的数字化进程中群星闪耀,艾萨克森从一个计算机程序的创造者、诗人拜伦之女埃达说起,细数了这一群站在科学与人文交叉路口的创新者,他们包括通用型电子计算机的创造者奠奇利、科学家冯·诺依曼、仙童半导体公司的“八叛逆”、天才图灵、英特尔的格鲁夫、微软的比尔·盖茨、苹果公司的乔布斯、谷歌的拉里·佩奇等。《创新......一起来看看 《创新者》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具