Html 如何使div内容垂直溢出?

Html 如何使div内容垂直溢出?,html,css,reactjs,Html,Css,Reactjs,现在,我有一个“profileDisplay”类的可滚动div,它在3列中显示一组概要文件组件(包括一个图像和一个段落)。我也不希望配置文件在列之间被拆分,因此我包含了以下css代码: .profileDisplay { max-width: 100%; overflow-y: scroll; height: 500px; column-count: 3; object-fit: fill; } .profileDisplay div { -we

现在,我有一个“profileDisplay”类的可滚动div,它在3列中显示一组概要文件组件(包括一个图像和一个段落)。我也不希望配置文件在列之间被拆分,因此我包含了以下css代码:

.profileDisplay {
    max-width: 100%;
    overflow-y: scroll;
    height: 500px;
    column-count: 3;
    object-fit: fill;
}

.profileDisplay div {
    -webkit-column-break-inside: avoid;
    break-inside: avoid;
}

.profileImg {
    height: 100%;
    width: 100%;
}

然而,所发生的情况是,当我添加越来越多的概要文件组件时,profileDisplay div并没有垂直溢出,而是不断地水平溢出(最终显示的列数超过3列,并且我永远不必垂直滚动)。我已经确认了,通过修改这个可滚动div的高度,无论出于什么原因,都可以避免div中的垂直溢出。如何使内容再次垂直溢出

下面是my profileDisplay div和Profile组件的代码:

import React from "react";
import './Profile'
class ProfileDisplay extends React.Component {
    render() {
        return (
            <div>
                <div className="profileDisplay">
                    {myArray.map(prof => ( //mapping my array of Profiles here
                        <div>
                            <Profile
                                avatar={prof.avatar}
                                bio={prof.bio}
                            />
                            <div >
                                <Button danger type="link">Delete</Button>
                            </div>
                        </div>
                    ))}
                </div>
            </div>   
        );
    }
}

export default ProfileDisplay;
从“React”导入React;
导入“./Profile”
类ProfileDisplay扩展了React.Component{
render(){
返回(
{myArray.map(prof=>(//在此处映射我的配置文件数组
删除
))}
);
}
}
导出默认配置文件显示;
从“React”导入React;
类概要文件扩展了React.Component{
render(){
报税表(
{this.props.bio}
);
}
}
导出默认配置文件;

记住将代码转换为一个。这是一点工作,但它帮助人们的帮助远远超过将代码简化为可行示例所需的时间。完成。谢谢你的建议。嗯,你展示的CSS有
flex:1
,这将使大多数web开发人员都会问“哪个元素是顶级显示:flex?”因为如果你问的是垂直对齐或溢出,那几乎肯定与“master”元素有关。这一点很好。我删除了它,因为它没有改变任何东西
import React from "react";
class Profile extends React.Component {
    render() {
        return ( 
            <div>
                <img className="profileImg" src={this.props.avatar} width="100px" height="100px"/>
                <div>{this.props.bio}</div>        
            </div>
        );
    }
}
export default Profile;