html - CSS:设置为 tbody/thead 时在 Chrome 中重复渐变

标签 html css google-chrome gradient

这里显示了我遇到的问题。基本上,当我在 thead 上放置渐变时,Chrome 会为每个单元格重复该渐变...实际期望的结果是 firefox 产生的结果 - 整个 thead 的纯渐变。

enter image description here

关于如何解决这个问题有什么想法吗?

这是我的 CSS:

thead.header {
    font-weight: bold;
    border-bottom: 1px solid #9C9C9C;
    background-repeat: no-repeat;
    background: #C6C6C6;
    background: -moz-linear-gradient(top, #DEDEDE 0%, #BDBDBD 80%, #BBB 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#DEDEDE), color-stop(80%,#BDBDBD), color-stop(100%,#BBB));
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#DEDEDE', endColorstr='#BBB',GradientType=0 );
}

如果有帮助,这里是 html:

  <table style="width:100%" cellpadding="0" cellspacing="0">
    <thead class="header">
      <tr>
        <th width="200px">Actor</th>
        <th rowspan="3">Character</th>
      </tr>
      <tr>
        <th>Gender</th>
      </tr>
      <tr>
        <th>Age</th>
      </tr>
    </thead>

    <tbody class="odd">
      <tr>
        <td width="200px">Test</td> 
        <td rowspan="3">Test</table>
        </td>
      </tr> 
      <tr>
        <td>Male</td>
      </tr> 
      <tr>
        <td>25</td>
      </tr>
    </tbody>
  </table>

最佳答案

在 thead 上设置 background-attachment:fixed; 就可以正常工作了

关于html - CSS:设置为 tbody/thead 时在 Chrome 中重复渐变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6356852/

相关文章:

php - 表单中的多个提交按钮

html - float 图像在相对位置上不在同一高度

html - 将聊天箭头从左侧移动到右侧

html - 使用 css3 在连续循环中动画 Z-index

javascript - Chrome 扩展内容安全策略指令错误

html - 跨度显示IE

javascript - 如何在 JavaScript 中将内容添加到动态创建的 div 中?

css - 为复选框和单选按钮覆盖 Bootstrap 4 的 scss 值

html - 悬停时 Chrome 中的 Z-Index 闪烁

asp.net - Chrome 渲染 asp.net block