【发布时间】:2021-02-19 14:11:35
【问题描述】:
我正在创建一个网格布局,其中包含嵌套的网格组件。但是,出于某种我不明白的原因,在 Grid 项目组件中使用内联样式不起作用。请帮忙,我在 ReactJS 中使用 MaterialUI 是个新手。 Grid 封装在 Hide 组件中,该组件仅在移动设备中显示。
我想要实现的是 Grid 项目改变颜色 悬停
这是我所做的:
<Hidden mdUp='hide'>
<Grid
container
xs={12}
style={{
fontFamily: 'Old Newspaper',
background: '#f49275',
'&:hover': { background: 'black' },
marginLeft: '4px',
marginRight: '4px',
}}
>
<Grid
item
xs={4}
style={{
justifyContent: 'center',
display: 'flex',
}}
>
<a href='#'>
♦ Github ♦
</a>
</Grid>
<Grid
item
xs={4}
style={{ justifyContent: 'center', display: 'flex' }}
>
<a
href='#'
target='_blank'
>
♦ LinkedIn ♦
</a>
</Grid>
<Grid
item
xs={4}
style={{ justifyContent: 'center', display: 'flex' }}
>
<a
href='#'
target='_blank'
>
♦ Codewars ♦
</a>
</Grid>
</Grid>
</Hidden>
【问题讨论】:
标签: css reactjs material-ui hover