m0_60535423 2022-07-03 18:08 采纳率: 100%
浏览 29
已结题

表格边框有一边有缝隙的问题

img

img


为什么这个边框右边会有一个缝隙,新手上路真的不知道问题出在哪里

  • 写回答

1条回答 默认 最新

  • Heerey525 前端领域新星创作者 2022-07-03 18:43
    关注

    表格(如果有启用border)外边框始终会存在一层border
    通过背景色遮挡缝隙

    table {
      background-color: black;
    }
    tr {
      background-color: white;
    }
    
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
          table {
            background-color: black;
          }
          tr {
            background-color: white;
          }
        </style>
      </head>
      <body>
        <table
          align="center"
          border="1"
          cellpadding="10px"
          cellspacing="0px"
          width="500"
          height="249"
        >
          <tr>
            <th>及格否</th>
            <th>姓名</th>
            <th>分数</th>
          </tr>
          <tr>
            <th>及格</th>
            <th>小明</th>
            <th>88</th>
          </tr>
          <tr>
            <th>及格</th>
            <th>小红</th>
            <th>86</th>
          </tr>
          <tr>
            <th>不及格</th>
            <th>小军</th>
            <th>56</th>
          </tr>
        </table>
      </body>
    </html>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 7月12日
  • 已采纳回答 7月4日
  • 创建了问题 7月3日

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line