javascript - 使用显示网格和填充时,带有样式组件的 React JS 应用程序不滚动
问题描述
所以,我有这个 TSX 文件和这个风格的 div 容器链接到它。这个想法是我有一张卡片,根据内容高度应该滚动或保持居中。到目前为止,它保持居中,但是当内容溢出时它不会滚动。有谁知道可以做什么?
import React from 'react';
import { Container } from './styles';
export const Notification: React.FC = () => {
return (
<Container>
<div className="card">
<div className="box" />
</div>
</Container>
);
};
import styled from 'styled-components';
export const Container = styled.div`
padding: 32px 48px;
min-height: 90vh;
width: 100%;
box-sizing: border-box;
display: grid;
.card {
background: white;
padding: 20px 24px;
.box {
height: 1500px;
background: red;
}
}
`;
解决方案
尝试操作相关元素的溢出属性以滚动
推荐阅读
- ios - 从 BLE 获取行数据并将其转换为字典
- oracle - 在 powershell 中使用作业执行 sqlplus 会话
- django - django模板不输出多个表单并保存到modelform
- amazon-web-services - AWS 签名创建。对如何将 SigningKey 和 SingingString 转换为 Signature 感到困惑。AWS 示例似乎没有产生预期的结果
- php - foreach 在 foreach laravel
- android - 抽屉布局不起作用android
- android - 应该在自定义列表视图中同时使用列表视图 setOnItemClickListener 和可编辑的编辑文本
- neo4j - Neo4j 中的关系(边缘)没有被创建
- jquery - 使用 jquery 在选择选项中添加默认值
- image - 如何在图像 url 参数中发送 Post 请求(在 Get 请求中)