[英]Cant make two divs next to each one with display flex
I have div .bigwrapper around everything .indexfilters around filters (filters are actually pink rectangle) .blockblockwrapper around videos 我在所有内容周围都有div .bigwrapper。过滤器周围的.indexfilters(过滤器实际上是粉红色矩形)。视频周围的.blockblockwrapper
problem is that when i add display:flex to .bigwrapper then .indexfilters disappear and i dont know where and why. 问题是,当我将display:flex添加到.bigwrapper时,.indexfilters消失了,我不知道在哪里以及为什么。 U can take a look at website if it helps https://vitas.sk/OnlineTv/ 您可以看一下网站是否有帮助https://vitas.sk/OnlineTv/
I want to have .indexfilters and .blockblockwrapper next to each one. 我想每个旁边都有.indexfilters和.blockblockwrapper。
<!-- BIG WRAPPER -->
<div class="bigwrapper">
<!-- BEGIN - FILTERS -->
<div class="indexfilters">
<div class="border">
</div>
</div>
<!-- END - FILTERS -->
<!-- BEGIN - Videos -->
<!-- 1 -->
<div class="blockblockwrapper">
<div class="blockwrapper">
<div class="videoblock">
<div class="insideblock">
<iframe src="https://player.vimeo.com/video/251979190?title=0&byline=0&portrait=0" width="240" height="135" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<a class="videoheading">Vegán bez čapice - 1</a>
<a class="videotext">Séria:2</a><br>
<a class="videotext">630 000 000 videní</a><br>
<a class="videotext">Pred 3 dňami</a><br>
</div>
//JUST VIDEOS ARE HERE - REMOVED FOR BETTER READING
<div class="insideblock">
<iframe src="https://player.vimeo.com/video/251979190?title=0&byline=0&portrait=0" width="240" height="135" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<a class="videoheading">Vegán bez čapice - 1</a>
<a class="videotext">Séria:2</a><br>
<a class="videotext">630 000 000 videní</a><br>
<a class="videotext">Pred 3 dňami</a><br>
</div>
</div>
</div>
</div>
</div>
<!-- END - Videos -->
CSS 的CSS
/* VIDEOS */
.videoblock {
width: 100%;
height: 230px;
display:flex;
justify-content: space-around;
}
.insideblock {
width: 240px;
}
.videoheading {
display: block;
font-weight: bold;
margin-top: 8px;
margin-bottom: 8px;
font-size: 14px;
}
.videotext {
color: grey;
font-size: 13px;
}
.blockwrapper {
display: flex;
flex-direction: column;
width: 60%;
float: right;
margin: 3% 5% 0% 0%;
}
/* Filters */
.border {
width: 10%;
height: 500px;
background-color: pink;
}
.bigwrapper {
width: 100%;
}
I changed my CSS to 我将CSS更改为
/* VIDEOS */
.videoblock {
width: 100%;
height: 230px;
display:flex;
justify-content: space-around;
}
.insideblock {
width: 240px;
}
.videoheading {
display: block;
font-weight: bold;
margin-top: 8px;
margin-bottom: 8px;
font-size: 14px;
}
.videotext {
color: grey;
font-size: 13px;
}
.blockwrapper {
display: flex;
flex-direction: column;
width: 100%;
background-color: bisque;
}
.blockblockwrapper{
background-color: green;
margin: 3% 5% 0% 0%;
width: 60%;
float: right;
}
/* Filters */
.border {
width: 100%;
height: 500px;
background-color: pink;
}
.indexfilters {
float: left;
width: 30%;
}
.bigwrapper {
width: 100%;
}
You have used extra unnecessary css in your code and also use %
values on width for proper layout. 您已经在代码中使用了多余的CSS,还使用了%
宽度值来实现正确的布局。
I have changed your css where required. 我已根据需要更改了您的CSS。
Stack Snippet 堆栈片段
.indexfilters { width: 10%; height: 500px; background-color: pink; } .bigwrapper { width: 100%; display: flex; flex-wrap: wrap; } .blockblockwrapper { width: 90%; } .blockwrapper { } .videoblock { width: 100%; height: 230px; display: flex; flex-wrap: wrap; } .insideblock { width: 50%; }
<div class="bigwrapper"> <div class="indexfilters"> <div class="border"></div> </div> <div class="blockblockwrapper"> <div class="blockwrapper"> <div class="videoblock"> <div class="insideblock"> <iframe src="https://player.vimeo.com/video/251979190?title=0&byline=0&portrait=0" width="100%" height="135" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <a class="videoheading">Vegán bez čapice - 1</a> <a class="videotext">Séria:2</a><br> <a class="videotext">630 000 000 videní</a><br> <a class="videotext">Pred 3 dňami</a><br> </div> <div class="insideblock"> <iframe src="https://player.vimeo.com/video/251979190?title=0&byline=0&portrait=0" width="100%" height="135" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <a class="videoheading">Vegán bez čapice - 1</a> <a class="videotext">Séria:2</a><br> <a class="videotext">630 000 000 videní</a><br> <a class="videotext">Pred 3 dňami</a><br> </div> </div> </div> </div> </div> <!-- END - Videos -->
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.