zoukankan      html  css  js  c++  java
  • <HTML>在一个表格内嵌套另一个表格时,如何居中?

    在一个表格内嵌套另一个表格时,如何居中?

    假设大表格为:

    <table id="tableRow">
      <tr>
        <th>City</th>
        <th>Date</th>
        <th>Temperature</th>
        <th>Altitude</th>
        <th>Population</th>
        <th>Diner Rating</th>
      </tr>
      <tr>
        <td>Walla Walla, WA</td>
        <td class="center">June 15th</td>
        <td class="center">75</td>
        <td>1,204 ft</td>
        <td>29,686</td>
        <td class="center">4/5</td>
      </tr>
      <tr class="cellcolor">
        <td>Magic City, ID</td>
        <td class="center">June 25th</td>
        <td class="center">74</td>
        <td class="">5,312 ft</td>
        <td>50</td>
        <td class="center">3/5</td>
      </tr>
      <tr>
        <td>Bountiful, UT</td>
        <td class="center"> July 10th</td>
        <td class="center">91</td>
        <td>4,226 ft</td>
        <td>41,173</td>
        <td class="center">4/5</td>
      </tr>
      <tr class="cellcolor">
        <td>Last Chance, CO</td>
        <td class="center">July 23rd</td>
        <td class="center">102</td>
        <td>4,780 ft</td>
        <td>265</td>
        <td class="center">3/5</td>
      </tr>
      <tr>
        <td rowspan="2">Truth or Consequences, NM</td>
        <td class="center">August 9th</td>
        <td class="center">93</td>
        <td rowspan="2">4,242 ft</td>
        <td rowspan="2">7,289</td>
        <td class="center">5/5</td>
      </tr>
      <tr>
        <td class="center">August 27th</td>
        <td class="center">98</td>
        <td class="center">
          <table>
            <tr>
              <th>Tess</th>
              <td>5/5</td>
            </tr>
            <tr>
              <th>Tony</th>
              <td>4/5</td>
            </tr>
          </table>
        </td>
      </tr>
      <tr class="cellcolor">
        <td>Why, AZ</td>
        <td class="center">August 18th</td>
        <td class="center">104</td>
        <td>860 ft</td>
        <td>480</td>
        <td class="center">3/5</td>
      </tr>
    </table>

    小表格为:

          <table>
            <tr>
              <th>Tess</th>
              <td>5/5</td>
            </tr>
            <tr>
              <th>Tony</th>
              <td>4/5</td>
            </tr>
          </table>

    使其居中的CSS为:

    table table
    {
      margin-left:      20px;
      margin-right:     20px;
    }

    效果:

    综上,在一个表格内嵌套另一个表格时,居中的一种方法为设置小表格的外边距。

  • 相关阅读:
    今天一天看一天文档
    ImportError: No module named _md5解决方案
    Spelling Corrector & sphinx typo search
    linux下使用ipython的pylab模式时不显示图形的问题解决方案
    error: error in setup script: command 'build_exe' has no such option 'includefiles'
    【转】oracle之包的创建和应用
    ADO.NET 与 ORACLE
    SQL注入大全
    【转】oracle之循环语法
    ASP.NET 防止按钮多次提交解决方法
  • 原文地址:https://www.cnblogs.com/isAndyWu/p/11462938.html
Copyright © 2011-2022 走看看