【发布时间】:2022-01-25 03:32:12
【问题描述】:
.test1 {
border: 2px solid black;
height: 220px;
width: 390px;
}
.test2 {
border: 2px solid black;
height: 220px;
width: 390px;
}
.random-content {
flex: 1 1 auto;
text-align: justify;
font-weight: 700;
margin-top: 20%;
margin-right: 150px;
}
.main-container {
background-color: #fff;
margin: 30px;
display: flex;
flex-direction: row;
height: 100%;
margin-top: 2%;
margin-right: 27px;
margin-left: 27px;
max-height: 100%;
max-width: 100%;
}
<div class="main-container">
<div class="test1">test1</div> //div is moving to right side, when random content is dis-appear
<div class="test2">test2</div> //div is moving to right side, when random content is dis-appear
<div class="random-content">random content</div> //my random-content, when click checkbox "content" will disappear
</div>
我遇到了类似的 CSS 问题,
最初 test1、test2、随机内容 div 位于左侧。而且我对随机内容具有功能,例如,当复选框单击内容将消失时。所以问题来了。当内容通过点击事件消失时,test1、test2 div 的位置会向右移动。
【问题讨论】: