html - 如何设置表格td的底线

标签 html css

我想制作费用收据,但无法在文本下方设置一行。

.invoice-box {
  max-width: 800px;
  margin: auto;
  padding: 30px;
  border: 1px solid #000;
  box-shadow: 0 0 10px rgba(0, 0, 0, .15);
  font-size: 16px;
  line-height: 24px;
  font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
  color: #000;
}

.invoice-box table {
  width: 100%;
  line-height: inherit;
  text-align: left;
}

.invoice-box table td {
  padding: 5px;
  vertical-align: top;
}


/*
.invoice-box table tr td:nth-child(2) {
  text-align: right;
}
*/

.invoice-box table tr.top table td {
  padding-bottom: 5px;
}

.invoice-box table tr.top table td.title {
  font-size: 45px;
  line-height: 45px;
  color: #333;
}

.invoice-box table tr.information table td {
  padding-bottom: 40px;
}

.invoice-box table tr.heading td {
  /*
  background: #eee;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  */
  background: #000;
  border-bottom: 1px solid #eee;
  font-weight: bold;
  color: #fff;
  font-family: century;
  text-align: center;
  font-size: 20px;
  vertical-align: middle;
  padding: 10px !important;
}

.invoice-box table tr.details td {
  padding-bottom: 20px;
}

.invoice-box table tr.item td {
  border-bottom: 1px solid #000;
}

.invoice-box table tr.item.last td {
  border-bottom: none;
}


/*
.invoice-box table tr.total td:nth-child(2) {
  border-top: 2px solid #eee;
  font-weight: bold;
}
*/

@media only screen and (max-width: 600px) {
  .invoice-box table tr.top table td {
    width: 100%;
    display: block;
    text-align: center;
  }
  .invoice-box table tr.information table td {
    width: 100%;
    display: block;
    text-align: center;
  }
}


/** RTL **/

.rtl {
  direction: rtl;
  font-family: Tahoma, 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
}

.rtl table {
  text-align: right;
}

.rtl table tr td:nth-child(2) {
  text-align: left;
}
<div class="invoice-box">
  <table cellpadding="0" cellspacing="0">
    <tr class="top">
      <td colspan="2">
        <table>
          <tr>
            <td>
              <h1 style="text-align: center; font-family: Century; font-size:  47px; font-weight: 900; margin: 0;">UTEC COMPUTER INSTITUTE</h1>
            </td>
          </tr>
          <tr>
            <td style="padding-bottom: 2px;">
              <h1 style="text-align: center; font-family: Century; font-size:  24px; font-weight: 900; margin: 0;">A Unit of Universal Training Education & Care Society</h1>
            </td>
          </tr>
          <tr>
            <td>
              <h1 style="text-align: center; font-family: Century; font-size:  16px; font-weight: 500; margin: 0;">
                Registered Under MSME, Govt. of India <br />Affiliated by National Board of Computer Eduction, NCT, New Delhi
              </h1>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr class="top">
      <td colspan="2">
        <table>
          <tr>
            <td style="text-align: center;">
              <h1 style="text-align: center; font-family: Century; font-size:  38px; font-weight: 900; margin: 0; background-color: #000; display: inline; color: #fff; padding: 5px; border-radius: 10px;">Fee Receipt</h1>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr class="top">
      <td colspan="2">
        <table>
          <tr>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">
              Receipt No.
            </td>
            <td>REC010101010</td>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">Date</td>
            <td>06-Augest-2018</td>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">Student Reg. No.</td>
            <td>UTEC01010001</td>
          </tr>
        </table>
      </td>
    </tr>
    <tr class="top">
      <td colspan="2">
        <table>
          <tr>
            <td style="font-family: century; font-size: 18px; font-weight: 500;">Received From</td>
            <td colspan="2">Neeraj Pathak</td>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">Dated</td>
            <td colspan="2">06-Augest-2018</td>
          </tr>
          <tr>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">
              By Cash / Cheque / D.D. No.
            </td>
            <td>Cash</td>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">Batch Timing</td>
            <td>12:00 PM to 1:00 PM</td>
          </tr>
          <tr>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">
              From the Bank
            </td>
            <td>ICICI Bank</td>
            <td style="font-family: century; font-size: 18px; font-weight: 500; ">On Account of</td>
            <td>Deepak Joshi</td>
          </tr>
        </table>
      </td>
    </tr>
    <tr class="top">
      <td colspan="2">
        <table style="border: 1px solid #000; border-collapse: collapse;">
          <tr class="heading">
            <td style="white-space: nowrap; border-right: 1px solid #fff; background: #000; border-bottom: 1px solid #000; font-weight: bold; color: #fff; font-family: century; text-align: center; font-size: 20px; vertical-align: middle; padding: 10px !important;">
              Course
            </td>
            <td style="white-space: nowrap; border-right: 1px solid #fff; background: #000; border-bottom: 1px solid #000; font-weight: bold; color: #fff; font-family: century; text-align: center; font-size: 20px; vertical-align: middle; padding: 10px !important; ">
              Installment No.
            </td>
            <td style="white-space: nowrap; border-right: 1px solid #fff; background: #000; border-bottom: 1px solid #000; font-weight: bold; color: #fff; font-family: century; text-align: center; font-size: 20px; vertical-align: middle; padding: 10px !important; ">
              Fee Amount
            </td>
            <td style="white-space: nowrap; border-right: 1px solid #fff; background: #000; border-bottom: 1px solid #000; font-weight: bold; color: #fff; font-family: century; text-align: center; font-size: 20px; vertical-align: middle; padding: 10px !important; ">
              GST
            </td>
            <td style="white-space: nowrap; border-left: 1px solid #fff; background: #000; border-bottom: 1px solid #000; font-weight: bold; color: #fff; font-family: century; text-align: center; font-size: 20px; vertical-align: middle; padding: 10px !important; ">
              G. Amount
            </td>
          </tr>
          <tr class="item">
            <td style="border: 1px solid #000;">
              ADVANCE DIPLOMA IN INFORMATION TECHNOLOGY
            </td>
            <td style="border: 1px solid #000;">
              1
            </td>
            <td style="border: 1px solid #000;">
              5000.00
            </td>
            <td style="border: 1px solid #000;">
              <span>--</span>
            </td>
            <td style="border: 1px solid #000;">
              <span>5000.00</span>
            </td>
          </tr>
          <tr>
            <td style="font-size: 23px; font-family: century;">
              Total Rs. In Words:
            </td>
            <td style="font-size: 20px; font-family: century;" colspan="4">
              Five Thousand Only
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</div>

最佳答案

将特定类添加到您想要的 td 中,它将具有 border-bottom css 属性

<td class="border-bottom">REC010101010</td>

CSS

.border-bottom {
   border-bottom: 1px solid #000;
}

关于html - 如何设置表格td的底线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51725195/

相关文章:

html - 悬停在不同元素上的效果

php - 将选项中的 "name"文本传递给 php 表单

javascript - 淡入/淡出 RGBA 背景颜色 - Jquery 脚本

HTML、CSS .. : different font size in buttons and selects than for plain text (at least in FF)

html - 单独元素的边距如何影响固定元素的位置?

javascript - Material Design LinearProgress 组件的工作示例

html - 响应列折叠得太快

android -::after 伪元素,一个下拉箭头,在 Android 上不显示

javascript - 如何在列表项上切换事件类?

css - asp.net mvc cssRewriteUrlTransform 多个参数