reactjs - 将滚动条限制在反应网格中的特定高度
问题描述
我想在带有滚动条的网格中显示项目以进行溢出。但是应该限制滚动条的高度,如图所示,以显示父网格中的条目数。
我想在滚动条上方显示每个网格中的项目数。目前,滚动条占据了网格左侧的全部空间。
<Grid container spacing={3}>
<Grid item xs>
<Paper className="flex-col-scroll">
<Paper
className={classes.paperStyle}
style={{direction: 'ltr' }}
>
Fedex
</Paper>
<Paper className={classes.paper} style = {{direction: 'ltr'}} onClick={handleClick}>
<Grid container spacing={4}>
<Grid item xs>
<Typography variant="caption">Fl</Typography>
</Grid>
<Grid style = {{overflow: 'hidden'}}item xs>
<Typography variant="caption">Icon </Typography>
</Grid>
<Grid style = {{overflow: 'hidden'}}item xs>
<Typography variant="caption">Samsung</Typography>
</Grid>
<Grid item xs>
<Typography variant="caption">#230-897</Typography>
</Grid>
</Grid>
</Paper>
<Paper className={classes.paper}>Carrier</Paper>
<Paper className={classes.paper}>Carrier</Paper>
<Paper className={classes.paper}>Carrier</Paper>
</Paper>
</Grid>
CSS:
.flex-col-scroll {
flex-grow: 1;
overflow: auto;
height: 200px;
direction: rtl;
}
::-webkit-scrollbar {
width: 12px;
border: 5px solid white;
}
::-webkit-scrollbar-button {
background-size:100%;
height:11px;
width:11px;
}
::-webkit-scrollbar-button:end {
display:block;
}
::-webkit-scrollbar-button:start {
display:block;
}
::-webkit-scrollbar-button:vertical:increment {
background-image:url(icons/down.png);
}
::-webkit-scrollbar-button:vertical:decrement {
background-image:url(icons/up.png);
}
以上是用于显示网格的html和css。
解决方案
推荐阅读
- windows - 如何调试 x64 windows 异常?
- python - 将具有类似内容的数据框的大字符串转换为数据框
- python - 将字符串转换应用于特定轴上的二维数组,矢量化
- angular - 我需要像 combineLatest 这样的东西,但是当任何可观察的发射时
- mysql - 为什么 DECLARE 在错误的位置?[MySQL 工作台]
- java - Android Studio 在 FragmentManager 中添加 Fragment
- mysql - 数字证书数据库设计
- python-3.x - OSError:libgdal.so.27:无法打开共享对象文件:没有这样的文件或目录
- flutter - 谷歌登录成功后 Flutter New 小部件不变
- html - 响应式网站的 CSS 网格布局