组件html不合适

时间:2018-08-03 12:59:31

标签: html css html5 css3

我需要您的帮助,正在创建一个电子邮件模板。我将添加到模板的组件之一是一个小的弹出式下拉列表,当您将鼠标悬停在文本“总计”上时,将显示该下拉菜单。 我的问题是它不在同一行上。 ID为“ Number1”的div应该出现在文本“ Josh”的下方。我怎么在同一行上?

组件html不合适。

注意:之后,我将在其下方添加与该Number1类似的几个div。

/* -------------------------------------     GLOBAL     A very basic CSS reset ------------------------------------- */

        * {
            margin: 0;
            padding: 0;
            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
            box-sizing: border-box;
            font-size: 14px;
        }

        img {
            max-width: 100%;
        }

        body {
            -webkit-font-smoothing: antialiased;
            -webkit-text-size-adjust: none;
            width: 100% !important;
            height: 100%;
            line-height: 1.6;
        }

        /* Let's make sure all tables have defaults */

        table td {
            vertical-align: top;
        }

        /* -------------------------------------     BODY & CONTAINER ------------------------------------- */

        body {
            background-color: #f6f6f6;
        }

        .body-wrap {
            background-color: #f6f6f6;
            width: 100%;
        }

        .container {
            display: block !important;
            max-width: 600px !important;
            margin: 0 auto !important;
            /* makes it centered */
            clear: both !important;
        }

        .content {
            max-width: 600px;
            margin: 0 auto;
            display: block;
            padding: 20px;
        }

        /* -------------------------------------     HEADER, FOOTER, MAIN ------------------------------------- */

        .main {
            background: #fff;
            border: 1px solid #e9e9e9;
            border-radius: 3px;
        }

        .content-wrap {
            padding: 20px;
        }

        .content-block {
            padding: 0 0 20px;
        }

        .header {
            width: 100%;
            margin-bottom: 20px;
        }

        .footer {
            width: 100%;
            clear: both;
            color: #999;
            padding: 20px;
        }

        .footer a {
            color: #999;
        }

        .footer p,
        .footer a,
        .footer unsubscribe,
        .footer td {
            font-size: 12px;
        }

        /* -------------------------------------     TYPOGRAPHY ------------------------------------- */

        h1,
        h2,
        h3 {
            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
            color: #000;
            margin: 40px 0 0;
            line-height: 1.2;
            font-weight: 400;
        }

        h1 {
            font-size: 32px;
            font-weight: 500;
        }

        h2 {
            font-size: 24px;
        }

        h3 {
            font-size: 18px;
        }

        h4 {
            font-size: 14px;
            font-weight: 600;
        }

        p,
        ul,
        ol {
            margin-bottom: 10px;
            font-weight: normal;
        }

        p li,
        ul li,
        ol li {
            margin-left: 5px;
            list-style-position: inside;
        }

        /* -------------------------------------     LINKS & BUTTONS ------------------------------------- */

        a {
            color: #1ab394;
            text-decoration: underline;
        }

        .btn-primary {
            text-decoration: none;
            color: #FFF;
            background-color: #1ab394;
            border: solid #1ab394;
            border-width: 5px 10px;
            line-height: 2;
            font-weight: bold;
            text-align: center;
            cursor: pointer;
            display: inline-block;
            border-radius: 5px;
            text-transform: capitalize;
        }

        /* -------------------------------------     OTHER STYLES THAT MIGHT BE USEFUL ------------------------------------- */

        .last {
            margin-bottom: 0;
        }

        .first {
            margin-top: 0;
        }

        .aligncenter {
            text-align: center;
        }

        .alignright {
            text-align: right;
        }

        .alignleft {
            text-align: left;
        }

        .clear {
            clear: both;
        }

        /* -------------------------------------     ALERTS     Change the class depending on warning email, good email or bad email ------------------------------------- */

        .alert {
            font-size: 16px;
            color: #fff;
            font-weight: 500;
            padding: 20px;
            text-align: center;
            border-radius: 3px 3px 0 0;
        }

        .alert a {
            color: #fff;
            text-decoration: none;
            font-weight: 500;
            font-size: 16px;
        }

        .alert.alert-warning {
            background: #f8ac59;
        }

        .alert.alert-bad {
            background: #ed5565;
        }

        .alert.alert-good {
            background: #1ab394;
        }

        /* -------------------------------------     INVOICE     Styles for the billing table ------------------------------------- */

        .invoice {
            margin: 40px auto;
            text-align: left;
            width: 80%;
        }

        .invoice td {
            padding: 1px 0;
        }

        .invoice .invoice-items {
            width: 100%;
        }

        .invoice .invoice-items td {
            border-top: #eee 1px solid;
            padding-left: 1px;
        }

        .invoice .invoice-items .total td {
            border-top: 2px solid #ddd;
            border-bottom: 2px solid #ddd;
            font-weight: 700;
        }

        /* -------------------------------------     RESPONSIVE AND MOBILE FRIENDLY STYLES ------------------------------------- */

        @media only screen and (max-width: 640px) {
            h1,
            h2,
            h3,
            h4 {
                font-weight: 600 !important;
                margin: 20px 0 5px !important;
            }
            h1 {
                font-size: 22px !important;
            }
            h2 {
                font-size: 18px !important;
            }
            h3 {
                font-size: 16px !important;
            }
            .container {
                width: 100% !important;
            }
            .content,
            .content-wrap {
                padding: 10px !important;
            }
            .invoice {
                width: 100% !important;
            }
        }

        .celulasValores {
            border: 1px solid #ddd;
            padding: 5px;
        }

        .bordas-left {
            border-top-left-radius: 40%;
            border-bottom-left-radius: 40%;
        }

        .bordas-right {
            border-top-right-radius: 40%;
            border-bottom-right-radius: 40%;
        }

        .total {
            border-color: #ddd;
        }

        .tableValores table {
            border-spacing: 5px;
        }

        .dropdown {
            position: relative;
            display: inline-block;

        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 360px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            padding: 12px 16px;
            z-index: 1;

        }

        .dropdown:hover .dropdown-content {
            display: block;

        }
<div class="dropdown">
  TOTAL:
  <div class="dropdown-content">



    <table>
      <tbody>
        <tr>
          <td>
            Josh
            <div aria-label="Basic example" id="Number1">
              <table class="tableValores">
                <tr>
                  <td title="15 Dias" class="celulasValores bordas-left" style="padding: 2px 5px;align:center;">16</td>
                  <td class="celulasValores" title="3 Dias" style="padding: 2px 5px;align:center">6</td>
                  <td class="celulasValores" title="Hoje" style="padding: 2px 5px;align:center">4</td>
                  <td class="celulasValores bordas-right" title="Último dia" style="padding: 2px 5px;align: center">0</td>
                </tr>
              </table>
            </div>
          </td>
          <td align="alignright" class="total">
            <div class="btn-group" role="group" aria-label="Basic example">
              <table class="tableValores">
                <tr>
                  <td title="Atrasado após a Ação" class="celulasValores bordas-left" style="padding: 2px 5px;align:center">26</td>
                  <td class="celulasValores" title="Atrasado após a Meta" style="padding: 2px 5px;align:center">0</td>
                  <td class="celulasValores bordas-right" title="Atrasado após o Vencimento" style="padding: 2px 5px;align:center">292</td>
                </tr>
              </table>
            </div>
          </td>
          <td align="alignright" class="total">
            <div class="btn-group" role="group" aria-label="Basic example">
              <table class="tableValores">
                <tr>
                  <td title="Aguardando Solicitação" class="celulasValores bordas-left" style="padding: 2px 5px;align:center">0</td>
                  <td class="celulasValores bordas-right" title="Retificando" style="padding: 2px 5px;align:center">0</td>
                </tr>
              </table>
            </div>
          </td>

        </tr>

      </tbody>
    </table>
  </div>

</div>

1 个答案:

答案 0 :(得分:3)

只需将您的名字“ Josh”放在表格单元格<td>内,一切都会转到正确的位置。

      <td>Josh</td>

/* -------------------------------------     GLOBAL     A very basic CSS reset ------------------------------------- */

        * {
            margin: 0;
            padding: 0;
            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
            box-sizing: border-box;
            font-size: 14px;
        }

        img {
            max-width: 100%;
        }

        body {
            -webkit-font-smoothing: antialiased;
            -webkit-text-size-adjust: none;
            width: 100% !important;
            height: 100%;
            line-height: 1.6;
        }

        /* Let's make sure all tables have defaults */

        table td {
            vertical-align: top;
        }

        /* -------------------------------------     BODY & CONTAINER ------------------------------------- */

        body {
            background-color: #f6f6f6;
        }

        .body-wrap {
            background-color: #f6f6f6;
            width: 100%;
        }

        .container {
            display: block !important;
            max-width: 600px !important;
            margin: 0 auto !important;
            /* makes it centered */
            clear: both !important;
        }

        .content {
            max-width: 600px;
            margin: 0 auto;
            display: block;
            padding: 20px;
        }

        /* -------------------------------------     HEADER, FOOTER, MAIN ------------------------------------- */

        .main {
            background: #fff;
            border: 1px solid #e9e9e9;
            border-radius: 3px;
        }

        .content-wrap {
            padding: 20px;
        }

        .content-block {
            padding: 0 0 20px;
        }

        .header {
            width: 100%;
            margin-bottom: 20px;
        }

        .footer {
            width: 100%;
            clear: both;
            color: #999;
            padding: 20px;
        }

        .footer a {
            color: #999;
        }

        .footer p,
        .footer a,
        .footer unsubscribe,
        .footer td {
            font-size: 12px;
        }

        /* -------------------------------------     TYPOGRAPHY ------------------------------------- */

        h1,
        h2,
        h3 {
            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
            color: #000;
            margin: 40px 0 0;
            line-height: 1.2;
            font-weight: 400;
        }

        h1 {
            font-size: 32px;
            font-weight: 500;
        }

        h2 {
            font-size: 24px;
        }

        h3 {
            font-size: 18px;
        }

        h4 {
            font-size: 14px;
            font-weight: 600;
        }

        p,
        ul,
        ol {
            margin-bottom: 10px;
            font-weight: normal;
        }

        p li,
        ul li,
        ol li {
            margin-left: 5px;
            list-style-position: inside;
        }

        /* -------------------------------------     LINKS & BUTTONS ------------------------------------- */

        a {
            color: #1ab394;
            text-decoration: underline;
        }

        .btn-primary {
            text-decoration: none;
            color: #FFF;
            background-color: #1ab394;
            border: solid #1ab394;
            border-width: 5px 10px;
            line-height: 2;
            font-weight: bold;
            text-align: center;
            cursor: pointer;
            display: inline-block;
            border-radius: 5px;
            text-transform: capitalize;
        }

        /* -------------------------------------     OTHER STYLES THAT MIGHT BE USEFUL ------------------------------------- */

        .last {
            margin-bottom: 0;
        }

        .first {
            margin-top: 0;
        }

        .aligncenter {
            text-align: center;
        }

        .alignright {
            text-align: right;
        }

        .alignleft {
            text-align: left;
        }

        .clear {
            clear: both;
        }

        /* -------------------------------------     ALERTS     Change the class depending on warning email, good email or bad email ------------------------------------- */

        .alert {
            font-size: 16px;
            color: #fff;
            font-weight: 500;
            padding: 20px;
            text-align: center;
            border-radius: 3px 3px 0 0;
        }

        .alert a {
            color: #fff;
            text-decoration: none;
            font-weight: 500;
            font-size: 16px;
        }

        .alert.alert-warning {
            background: #f8ac59;
        }

        .alert.alert-bad {
            background: #ed5565;
        }

        .alert.alert-good {
            background: #1ab394;
        }

        /* -------------------------------------     INVOICE     Styles for the billing table ------------------------------------- */

        .invoice {
            margin: 40px auto;
            text-align: left;
            width: 80%;
        }

        .invoice td {
            padding: 1px 0;
        }

        .invoice .invoice-items {
            width: 100%;
        }

        .invoice .invoice-items td {
            border-top: #eee 1px solid;
            padding-left: 1px;
        }

        .invoice .invoice-items .total td {
            border-top: 2px solid #ddd;
            border-bottom: 2px solid #ddd;
            font-weight: 700;
        }

        /* -------------------------------------     RESPONSIVE AND MOBILE FRIENDLY STYLES ------------------------------------- */

        @media only screen and (max-width: 640px) {
            h1,
            h2,
            h3,
            h4 {
                font-weight: 600 !important;
                margin: 20px 0 5px !important;
            }
            h1 {
                font-size: 22px !important;
            }
            h2 {
                font-size: 18px !important;
            }
            h3 {
                font-size: 16px !important;
            }
            .container {
                width: 100% !important;
            }
            .content,
            .content-wrap {
                padding: 10px !important;
            }
            .invoice {
                width: 100% !important;
            }
        }

        .celulasValores {
            border: 1px solid #ddd;
            padding: 5px;
        }

        .bordas-left {
            border-top-left-radius: 40%;
            border-bottom-left-radius: 40%;
        }

        .bordas-right {
            border-top-right-radius: 40%;
            border-bottom-right-radius: 40%;
        }

        .total {
            border-color: #ddd;
        }

        .tableValores table {
            border-spacing: 5px;
        }

        .dropdown {
            position: relative;
            display: inline-block;

        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 360px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            padding: 12px 16px;
            z-index: 1;

        }

        .dropdown:hover .dropdown-content {
            display: block;

        }
<div class="dropdown">
  TOTAL:
  <div class="dropdown-content">



    <table>
      <tbody>
        <tr>
          <td>
            Josh
          </td>
          <td>
            <div aria-label="Basic example" id="Number1">
              <table class="tableValores">
                <tr>
                  <td title="15 Dias" class="celulasValores bordas-left" style="padding: 2px 5px;align:center;">16</td>
                  <td class="celulasValores" title="3 Dias" style="padding: 2px 5px;align:center">6</td>
                  <td class="celulasValores" title="Hoje" style="padding: 2px 5px;align:center">4</td>
                  <td class="celulasValores bordas-right" title="Último dia" style="padding: 2px 5px;align: center">0</td>
                </tr>
              </table>
            </div>
          </td>
          <td align="alignright" class="total">
            <div class="btn-group" role="group" aria-label="Basic example">
              <table class="tableValores">
                <tr>
                  <td title="Atrasado após a Ação" class="celulasValores bordas-left" style="padding: 2px 5px;align:center">26</td>
                  <td class="celulasValores" title="Atrasado após a Meta" style="padding: 2px 5px;align:center">0</td>
                  <td class="celulasValores bordas-right" title="Atrasado após o Vencimento" style="padding: 2px 5px;align:center">292</td>
                </tr>
              </table>
            </div>
          </td>
          <td align="alignright" class="total">
            <div class="btn-group" role="group" aria-label="Basic example">
              <table class="tableValores">
                <tr>
                  <td title="Aguardando Solicitação" class="celulasValores bordas-left" style="padding: 2px 5px;align:center">0</td>
                  <td class="celulasValores bordas-right" title="Retificando" style="padding: 2px 5px;align:center">0</td>
                </tr>
              </table>
            </div>
          </td>

        </tr>

      </tbody>
    </table>
  </div>

</div>