Questions tagged «styled-components»

4
将鼠标悬停在另一个样式化的组件上
处理样式化组件中悬停的最佳方法是什么?我有一个包装元素,将鼠标悬停时会显示一个按钮。 我可以在组件上实现某些状态并在悬停时切换属性,但是想知道是否有更好的方法可以使用styled-cmponents来实现。 如下所示的方法不起作用,但很理想: const Wrapper = styled.div` border-radius: 0.25rem; overflow: hidden; box-shadow: 0 3px 10px -3px rgba(0, 0, 0, 0.25); &:not(:last-child) { margin-bottom: 2rem; } &:hover { .button { display: none; } } `
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.