<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 悬停和斑马效果的表格

        Table with Rowspan Hover and Zebra effect(具有 Rowspan 悬停和斑马效果的表格)
      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 悬停和斑马效果的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Move link image 5px up on hover(悬停时将链接图像向上移动 5px)
                  How do I inspect CSS pseudo classes with firebug?(如何使用 firebug 检查 CSS 伪类?)
                  Why doesn#39;t CSS hover work on table rows when the cells inside the rows have class names?(当行内的单元格具有类名时,为什么 CSS 悬停在表格行上不起作用?)
                  Hover image - display div over it(悬停图像 - 在其上显示 div)
                  How to apply a CSS class on hover to dynamically generated submit buttons?(如何在悬停时将 CSS 类应用于动态生成的提交按钮?)
                  Differences between CSS3 :hover and :focus?(CSS3 :hover 和 :focus 的区别?)
                    <bdo id='GhrAi'></bdo><ul id='GhrAi'></ul>
                        <tbody id='GhrAi'></tbody>
                    • <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>
                        • <small id='GhrAi'></small><noframes id='GhrAi'>

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