gpt4 book ai didi

css - React 模态和媒体查询

转载 作者:行者123 更新时间:2023-11-28 00:00:16 25 4
gpt4 key购买 nike

我希望有人能告诉我如何让这个 react 模态移动响应。它没有使用 Bootstrap 。

<ReactModal 
isOpen={this.state.showModal}
style={{
overlay: {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(0, 0, 0, 0.5)'
},
content: {
position: 'absolute',
top: 'auto',
marginLeft: '70px',
marginRight: '70px',
bottom: '200px',
border: '1px solid #ccc',
background: '#000',
overflow: 'auto',
WebkitOverflowScrolling: 'touch',
borderRadius: '10px',
outline: 'none',
padding: '20px'
}
}}>

最佳答案

您将无法将媒体查询添加到模态框的内联样式中。

要添加媒体查询,您应该使用类:

React-modal Demo on GitHub: Using CSS classes for styling

然后您将能够在您的 CSS 中为不同类型的屏幕添加不同的样式。

关于css - React 模态和媒体查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56027077/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com