代码之家  ›  专栏  ›  技术社区  ›  Neeraj Pathak

如何设置表td的底线

  •  0
  • Neeraj Pathak  · 技术社区  · 8 年前

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

    .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>
    1 回复  |  直到 8 年前
        1
  •  0
  •   Mojo Allmighty    8 年前

    将特定类添加到所需的 td 这将有 border-bottom css属性

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

    Css

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