简体   繁体   English

样式化的组件填充 MUI 网格内的 div 高度

[英]Styled Component fill div height inside MUI Grid

The two cells marked as pink becomes pink on mouse hover.标记为红色的两个细胞在小鼠 hover 上变为粉红色。 How can I fill the grid with pink 100% width & height on mouse hover?如何在鼠标 hover 上用粉色 100% 宽度和高度填充网格?

sandbox 沙盒

You are using the ListItem as your grid container (not sure if this is a requirement or it was just easy for you), and by default the ListItem component has padding.您正在使用ListItem作为网格容器(不确定这是必需的还是对您来说很容易),并且默认情况下ListItem组件具有填充。

You can disable this padding by settings the padding of that component to 0:您可以通过将该组件的填充设置为 0 来禁用此填充:

<ListItem button style={{padding: 0}}>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM