标题带背景图片的表格

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

核心属性

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. }

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

查看所有标签

猜你喜欢:

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

大型网站技术架构

大型网站技术架构

李智慧 / 电子工业出版社 / 2013-9-1 / 59.00元

《大型网站技术架构:核心原理与案例分析》通过梳理大型网站技术发展历程,剖析大型网站技术架构模式,深入讲述大型互联网架构设计的核心原理,并通过一组典型网站技术架构设计案例,为读者呈现一幅包括技术选型、架构设计、性能优化、Web 安全、系统发布、运维监控等在内的大型网站开发全景视图。 《大型网站技术架构:核心原理与案例分析》不仅适用于指导网站工程师、架构师进行网站技术架构设计,也可用于指导产品经......一起来看看 《大型网站技术架构》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具