css - 从 child 身上移除变换和透视。 not() 并重新指定不起作用

标签 css

https://jsfiddle.net/98uo6h2e/2/

所以我使用下面的代码制作了一个透视效果。我想排除 .hello2 仅使用 CSS 采用变换和/或透视效果。我该怎么做呢?

已经尝试将 transform & webkit 重新指定为 none/unset/initial in .hello nothing happened..

<table id="hello">
  <tbody>
    <tr>
      <td>
        <div class="hello2">
          <strong>Test</strong>
          <h2>Test2</h2>
        </div>
      </td>
    </tr>
  </tbody>
</table>


table#hello:not(.hello2) {
  -webkit-perspective-origin: center top;
  -webkit-perspective: 100;
}

tbody:not(.hello2) {
  transform: rotate3d(0.1, 0, 0, 40deg);
  -webkit-transform-origin: center top;
}

.hello2 {
  -webkit-transform-origin: initial;
  -webkit-perspective-origin: initial;
  -webkit-perspective: initial;
}

最佳答案

您可以使用:not 选择器。

table#hello:not(.hello2) {
    -webkit-perspective-origin: center top;
    -webkit-perspective: 100;
}
tbody:not(.hello2) {
    transform: rotate3d(0.1, 0, 0, 40deg); 
    -webkit-transform-origin: center top;
}

关于css - 从 child 身上移除变换和透视。 not() 并重新指定不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56436536/

相关文章:

javascript - 通过正则表达式从盒子阴影中获取每个值

css - Styled-component vs jss vs React 的情感

html - 如何在汉堡菜单中加入链接?

html - 悬停后 CSS 菜单消失

javascript - 如何将滚动速度更改为平滑?

javascript - html/css/javascript 元素模块化最佳实践

html - 使图像占据 flex 元素的全高

jquery - 如何使用 CSS 设置 png 图标集合?

css - Internet Explorer 透明度

javascript - 如何修复同时加载两个组件的错误?