<bdo id='SUcSe'></bdo><ul id='SUcSe'></ul>
<tfoot id='SUcSe'></tfoot>
<legend id='SUcSe'><style id='SUcSe'><dir id='SUcSe'><q id='SUcSe'></q></dir></style></legend>
      1. <i id='SUcSe'><tr id='SUcSe'><dt id='SUcSe'><q id='SUcSe'><span id='SUcSe'><b id='SUcSe'><form id='SUcSe'><ins id='SUcSe'></ins><ul id='SUcSe'></ul><sub id='SUcSe'></sub></form><legend id='SUcSe'></legend><bdo id='SUcSe'><pre id='SUcSe'><center id='SUcSe'></center></pre></bdo></b><th id='SUcSe'></th></span></q></dt></tr></i><div id='SUcSe'><tfoot id='SUcSe'></tfoot><dl id='SUcSe'><fieldset id='SUcSe'></fieldset></dl></div>

        <small id='SUcSe'></small><noframes id='SUcSe'>

        具有 Rowspan 悬停和斑马效果的表格

        时间:2023-11-29
      2. <tfoot id='BqsGR'></tfoot>

        <small id='BqsGR'></small><noframes id='BqsGR'>

          <legend id='BqsGR'><style id='BqsGR'><dir id='BqsGR'><q id='BqsGR'></q></dir></style></legend>
          <i id='BqsGR'><tr id='BqsGR'><dt id='BqsGR'><q id='BqsGR'><span id='BqsGR'><b id='BqsGR'><form id='BqsGR'><ins id='BqsGR'></ins><ul id='BqsGR'></ul><sub id='BqsGR'></sub></form><legend id='BqsGR'></legend><bdo id='BqsGR'><pre id='BqsGR'><center id='BqsGR'></center></pre></bdo></b><th id='BqsGR'></th></span></q></dt></tr></i><div id='BqsGR'><tfoot id='BqsGR'></tfoot><dl id='BqsGR'><fieldset id='BqsGR'></fieldset></dl></div>

                • <bdo id='BqsGR'></bdo><ul id='BqsGR'></ul>

                    <tbody id='BqsGR'></tbody>
                • 本文介绍了具有 Rowspan 悬停和斑马效果的表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试创建一个具有行跨度、斑马纹效果并在悬停时突出显示该行的表格.我有点得到它的工作,但不完全.

                  I am trying to create a table that has a rowspan, zebra effect and highlights the row on hover. I kind of got it working but not quite.

                  应该是这样的:http://codepen.io/chriscoyier/pen/wLGDz 加上行上的斑马效应.不幸的是,使用 jQuery 或 CSS 的斑马效果对我不起作用,因为如果我这样做,悬停时线条不会改变.

                  It should be like this: http://codepen.io/chriscoyier/pen/wLGDz plus a zebra effect on the rows. Unfortunately a zebra effect using jQuery or CSS does not work for me as the lines won't change on hover if I do that.

                  有什么建议吗?<代码>

                  推荐答案

                  这是 tbody 的工作.至少早在 HTML4 中就允许在一个表格中使用多个 tbody 元素,它们旨在将相关行组合在一起.这样一来,您就完全不需要 JavaScript.

                  This is a job for tbody. Multiple tbody elements are allowed in a table at least as far back as HTML4, and they're designed for grouping related rows together. This way, you don't need JavaScript at all.

                  body {
                    padding: 1em;
                  }
                  
                  table {
                    width: 100%;
                    border-collapse: collapse;
                  }
                  
                  td,
                  th {
                    padding: .25em;
                    border: 1px solid black;
                  }
                  
                  tbody:nth-child(odd) {
                    background: #CCC;
                  }
                  
                  tbody:hover td[rowspan],
                  tr:hover td {
                    background: red;
                  }

                  <table>
                    <tbody>
                      <tr>
                        <td rowspan="3"></td>
                        <td>a</td>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td>b</td>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td>c</td>
                        <td></td>
                        <td></td>
                      </tr>
                    </tbody>
                  
                    <tbody>
                      <tr>
                        <td rowspan="3"></td>
                        <td>a</td>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td>b</td>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td>c</td>
                        <td></td>
                        <td></td>
                      </tr>
                    </tbody>
                  
                    <tbody>
                      <tr>
                        <td rowspan="3"></td>
                        <td>a</td>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td>b</td>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td>c</td>
                        <td></td>
                        <td></td>
                      </tr>
                    </tbody>
                  </table>

                  这篇关于具有 Rowspan 悬停和斑马效果的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使图像悬停在css中? 下一篇:从 :hover with .css() 获取 css 值 - jquery

                  相关文章

                    <bdo id='GhrAi'></bdo><ul id='GhrAi'></ul>
                • <tfoot id='GhrAi'></tfoot>
                  1. <i id='GhrAi'><tr id='GhrAi'><dt id='GhrAi'><q id='GhrAi'><span id='GhrAi'><b id='GhrAi'><form id='GhrAi'><ins id='GhrAi'></ins><ul id='GhrAi'></ul><sub id='GhrAi'></sub></form><legend id='GhrAi'></legend><bdo id='GhrAi'><pre id='GhrAi'><center id='GhrAi'></center></pre></bdo></b><th id='GhrAi'></th></span></q></dt></tr></i><div id='GhrAi'><tfoot id='GhrAi'></tfoot><dl id='GhrAi'><fieldset id='GhrAi'></fieldset></dl></div>
                  2. <small id='GhrAi'></small><noframes id='GhrAi'>

                    <legend id='GhrAi'><style id='GhrAi'><dir id='GhrAi'><q id='GhrAi'></q></dir></style></legend>