CSS background color not rendering when an element has margin-top

تبليغ
سؤال

يرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.

تبليغ
‎إلغاء

I’m working on a website, and something awkward happens when I use margin-top. I have a div called “row” with two children: “side” and “main”. I also have another div called “gallery”. There’s content on the “side” that I can only render using margin-top on the gallery because it blocks that content. However, the side has a background color that isn’t showing.

.row {
text-align: center;
display: flex;
flex-wrap: wrap;
}

.side {
flex: 30%;
background-color: #f1f1f1;
padding: 20px;
}

.main {
flex: 70%;
background-color: white;
padding: 20px;
}

.gallery {
margin-top: 200px;
overflow: hidden;
}
<div class=”row”>
<div class=”side”>

<!– content not rendering –>
<p class=”subtitle”>trailer</p>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptatem quas, sint vitae veniam deserunt facere eos similique commodi eligendi blanditiis, iste minus facilis soluta labore neque cumque inventore, ea doloremque.
</p>
</div>
<div class=”main”>

</div>
</div>
<div id=”gallery” class=”gallery”>

</div>

0
X 5 أشهر 2022-07-10T12:01:24+03:00 0 إجابة 0 مشاهدات مبتدئ 0

‫أضف إجابة

تصفح
تصفح

مجهول يجيب