我想在表格中的文字下面写一行

问题描述 投票:2回答:2

我想在文本下面制作一个边框/框架,如下图所示

      table.blueTable {
      background-color: #5F80A8;
      height: 200px;
      width: 50%;
      margin: auto;
      position: relative;
      bottom: -165px;
      color: white;
    }

    table.blueTable td {
      font-size: 1.3em;
    }

    #uno,
    #tre,

    {
      text-align: center;
      line-height: 4em;
    }

    #due,
    #quattro,

    {
      text-align: left;
    }
<!DOCTYPE html>
    <html lang="ja">

    <head>
    	<meta charset="UTF-8">
    	<meta name="viewport" content="width=device-width, initial-scale=1">

    	<title>table6</title>
      <table class="blueTable">
    <tbody>
    <tr>
    <td id="uno">初期費用</td>
    <td id="due">15万~30万<br>(選択プランによる</td>
    </tr>
    <tr>
    <td id="tre">月額費用</td>
    <td id="quattro">5万~15万<br>(選択プランによる)<br>+SMS送信料 12円/通<br>+IVR利用料 8円/60秒</td>
    </tr>
    </tbody>
    </tr>
    </table>
</body>
</html>
html css
2个回答
2
投票

您可以为表边框添加css,如下所示:

    td, th {
border: solid 1px;
border-left: none;
border-top: none;
} 

这是您更新的代码:

      table.blueTable {
      background-color: #5F80A8;
      height: 200px;
      width: 50%;
      margin: auto;
      position: relative;
      bottom: -165px;
      color: white;
    }
 
    td, th {
    border: solid 1px;
    border-left: none;
    border-top: none;
} 

    table.blueTable td {
      font-size: 1.3em;
       border-bottom: 1px solid #fff;
    }

    #uno,
    #tre,

    {
      text-align: center;
      line-height: 4em;
    }

    #due,
    #quattro,

    {
      text-align: left;
    }
<!DOCTYPE html>
    <html lang="ja">

    <head>
    	<meta charset="UTF-8">
    	<meta name="viewport" content="width=device-width, initial-scale=1">

    	<title>table6</title>
      <table class="blueTable">
    <tbody>
    <tr>
    <td id="uno">初期費用</td>
    <td id="due">15万~30万<br>(選択プランによる</td>
    </tr>
    <tr>
    <td id="tre">月額費用</td>
    <td id="quattro">5万~15万<br>(選択プランによる)<br>+SMS送信料 12円/通<br>+IVR利用料 8円/60秒</td>
    </tr>
    </tbody>
    </tr>
    </table>
</body>
</html>

希望这可以帮助 !


0
投票

你可以在表标签中添加cellspacing吗?希望这能解决问题。

 <table class="blueTable" cellspacing="30">
   <tbody>
     <tr>
     <td></td>
     </tr>
  </tbody>
</table>

table.blueTable td {
 font-size: 1.3em;
 border-bottom: 1px solid #fff;
 border-right: 1px solid #fff;
 }
© www.soinside.com 2019 - 2024. All rights reserved.