标题带背景图片的表格

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

核心属性

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

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

查看所有标签

猜你喜欢:

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

失控的未来

失控的未来

[美]约翰·C·黑文斯 / 仝琳 / 中信出版集团 / 2017-4-1 / 59.00元

【编辑推荐】 20年前,尼古拉•尼葛洛庞帝的《数字化生存》描绘了数字科技给人们的工作、生活、教育和娱乐带来的冲击和各种值得思考的问题。数字化生存是一种社会生存状态,即以数字化形式显现的存在状态。20年后,本书以一种畅想的形式,展望了未来智能机器人与人类工作、生活紧密相联的场景。作者尤其对智能机器人与人类的关系,通过假设的场景进行了大胆有趣的描述,提出了人工智能的未来可能会面临的一些问题。黑文......一起来看看 《失控的未来》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器