这是一个codepen。当您更改视图高度时,请注意紫色元素。他们溢出。我想彻底杀死这条巨龙 - 更重要的是 - 了解发生了什么事情,所以我再也不用打扰你。当视图高度/宽度更改时,如何让子元素保留在父元素中?
https://codepen.io/colbisaurusrex/pen/WpXVxY
body {
background-color: #34495E;
padding: 5%;
}
.container {
height: 100vh;
display: flex;
}
.columnleft {
background-color: #2ECC71;
height: 100%;
width: 30%;
margin-right: 10%;
}
.leftbox {
margin: 10%;
height: 100%;
}
.box {
display: flex;
background-color: #1ABC9C;
margin: 10%;
height: 40%;
}
.innerbox {
background-color: #3498DB;
height: 96%;
width: 47%;
margin: 2%;
}
.columnright {
background-color: #2ECC71;
height: 100%;
width: 60%;
}
.row {
display: flex;
height: 40%;
background-color: #9B59B6;
width: 80%;
margin-right: 10%;
margin-left: 10%;
}
.rowone {
margin-top: 5%;
margin-bottom: 5%;
}
.rowtwo {
margin-bottom: 5%;
}
谢谢你的答案。我意识到溢出属性,但我希望元素能够响应并改变大小。应该已经更清楚了。 – colbisaurusrex