'How to stop my flexbox overlapping my content?
My container element has a flexbox structure and it keeps overlapping with my footer in the mobile view. While in the desktop view it looks clean. I am sharing the snippet of code. Please can someone tell what I am doing wrong.
.container {
height: 100%;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
background: -webkit-linear-gradient(#fff);
background: linear-gradient(#fff);
}
ul {
margin: 0;
padding: 0;
}
ul li {
list-style: none;
padding-left: 10px;
cursor: pointer;
}
ul li:hover {
background: rgba(255, 255, 255, 0.1);
}
.thin {
font-weight: 400;
}
.small {
font-size: 12px;
font-size: .8rem;
}
.half-input-table {
border-collapse: collapse;
width: 100%;
}
.half-input-table td:first-of-type {
border-right: 10px solid #4488dd;
width: 50%;
}
.window {
height: 540px;
width: 800px;
background: #fff;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
box-shadow: 0px 15px 50px 10px rgba(0, 0, 0, 0.2);
border-radius: 30px;
z-index: 10;
}
.order-info {
height: 100%;
width: 50%;
padding-left: 25px;
padding-right: 25px;
box-sizing: border-box;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
position: relative;
}
.price {
bottom: 0px;
position: absolute;
right: 0px;
color: #4488dd;
}
.order-table td:first-of-type {
width: 25%;
}
.order-table {
position: relative;
}
.line {
height: 1px;
width: 100%;
margin-top: 10px;
margin-bottom: 10px;
background: #ddd;
}
.order-table td:last-of-type {
vertical-align: top;
padding-left: 25px;
}
.order-info-content {
table-layout: fixed;
}
.full-width {
width: 100%;
}
.pay-btn {
border: none;
background: #fff;
line-height: 2em;
border-radius: 10px;
font-size: 19px;
font-size: 1.2rem;
color: #000;
cursor: pointer;
position: absolute;
bottom: 25px;
width: calc(100% - 50px);
-webkit-transition: all .2s ease;
transition: all .2s ease;
}
.pay-btn:hover {
background: #C4C7F5;
color: #000;
-webkit-transition: all .2s ease;
transition: all .2s ease;
}
.total {
margin-top: 25px;
font-size: 20px;
font-size: 1.3rem;
position: absolute;
bottom: 30px;
right: 27px;
left: 35px;
}
.dense {
line-height: 1.2em;
font-size: 16px;
font-size: 1rem;
}
.input-field {
background: rgba(255, 255, 255, 0.1);
margin-bottom: 10px;
margin-top: 3px;
line-height: 1.5em;
font-size: 20px;
font-size: 1.3rem;
border: none;
padding: 5px 10px 5px 10px;
color: #fff;
box-sizing: border-box;
width: 100%;
margin-left: auto;
margin-right: auto;
}
.credit-info {
background: #4488dd;
height: 100%;
width: 50%;
color: #eee;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
font-size: 14px;
font-size: .9rem;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
box-sizing: border-box;
padding-left: 25px;
padding-right: 25px;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
position: relative;
}
.dropdown-btn {
background: rgba(255, 255, 255, 0.1);
width: 100%;
border-radius: 5px;
text-align: center;
line-height: 1.5em;
cursor: pointer;
position: relative;
-webkit-transition: background .2s ease;
transition: background .2s ease;
}
.dropdown-btn:after {
content: '\25BE';
right: 8px;
position: absolute;
}
.dropdown-btn:hover {
background: rgba(255, 255, 255, 0.2);
-webkit-transition: background .2s ease;
transition: background .2s ease;
}
.dropdown-select {
display: none;
}
.credit-card-image {
display: block;
max-height: 80px;
margin-left: auto;
margin-right: auto;
margin-top: 35px;
margin-bottom: 15px;
}
.credit-info-content {
margin-top: 25px;
-webkit-flex-flow: column;
-ms-flex-flow: column;
flex-flow: column;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
width: 100%;
}
@media (max-width: 600px) {
.window {
width: 100%;
height: 100%;
display: block;
border-radius: 0px;
}
.order-info {
width: 100%;
height: auto;
padding-bottom: 100px;
border-radius: 0px;
}
.credit-info {
width: 100%;
height: auto;
padding-bottom: 100px;
border-radius: 0px;
}
.pay-btn {
border-radius: 0px;
}
}
<div class="container">
<div class="window">
<div class="order-info">
<div class="order-info-content">
<h2>Order Summary</h2>
<div class="line"></div>
<table class="order-table">
<tbody>
<tr>
<td><img src="images/checkout1.webp" class="full-width">
</td>
<td>
<br> <span class="thin">Eco Aware</span>
<br> Organic Top<br> <span class="thin small"> Color: Black/White, Size: M<br><br></span>
</td>
</tr>
<tr>
<td>
<div class="price">$39</div>
</td>
</tr>
</tbody>
</table>
<div class="line"></div>
<table class="order-table">
<tbody>
<tr>
<td><img src="images/checkout2.webp" class="full-width">
</td>
<td>
<br> <span class="thin">Eco Aware</span>
<br>Lightweight Fitted Jumper<br> <span class="thin small"> Color: Pink, Size: L</span>
</td>
</tr>
<tr>
<td>
<div class="price">$79</div>
</td>
</tr>
</tbody>
</table>
<div class="line"></div>
<div class="total">
<span style="float:left;">
<div class="thin dense">VAT 19%</div>
<div class="thin dense">Delivery</div>
TOTAL
</span>
<span style="float:right; text-align:right;">
<div class="thin dense">$118</div>
<div class="thin dense">$4.95</div>
$122.95
</span>
</div>
</div>
</div>
<div class="credit-info">
<div class="credit-info-content">
<table class="half-input-table">
<tr>
<td>Please select your card: </td>
<td>
<div class="dropdown" id="card-dropdown">
<div class="dropdown-btn" id="current-card">Visa</div>
<div class="dropdown-select">
<ul>
<li>Master Card</li>
<li>American Express</li>
</ul>
</div>
</div>
</td>
</tr>
</table>
<img src="https://dl.dropboxusercontent.com/s/ubamyu6mzov5c80/visa_logo%20%281%29.png" height="80" class="credit-card-image" id="credit-card-image">
Card Number
<input class="input-field">
Card Holder
<input class="input-field">
<table class="half-input-table">
<tr>
<td> Expires
<input class="input-field">
</td>
<td>CVC
<input class="input-field">
</td>
</tr>
</table>
<button class="pay-btn">Checkout</button>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="row">
<div class="col d-flex">
<h4>INFORMATION</h4>
<a href="">About us</a>
<a href="">Contact Us</a>
<a href="">Term & Conditions</a>
<a href="">Shipping Guide</a>
</div>
<div class="col d-flex">
<h4>USEFUL LINK</h4>
<a href="">Online Store</a>
<a href="">Customer Services</a>
<a href="">Promotion</a>
<a href="">Top Brands</a>
</div>
<div class="col d-flex">
<span><i class="bx bxl-facebook-square"></i></span>
<span><i class="bx bxl-instagram-alt"></i></span>
<span><i class="bx bxl-github"></i></span>
<span><i class="bx bxl-twitter"></i></span>
<span><i class="bx bxl-pinterest"></i></span>
</div>
</div>
</footer>
This is the code. I don't know why it overlapping my content in the mobile layout.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
