Is there a way to resize an image that is set by percentage in a dynamically sized div? Currently, I am facing an issue where the layout looks perfect without the image, but breaks when the image is added. I want all units to be consistent and find a solution to fit the photo into the div without disrupting the entire layout.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
}
/* == WHOLE PAGE ==*/
.landing{
width: 100%;
height: 100%;
display: flex;
flex-flow: column;
}
/* HEADER */
.header{
background: #F582A7;
flex: 0 1 10%;
display: flex;
justify-content: center;
align-items: center;
}
.header > ul{
display: flex;
flex-direction: row;
list-style: none;
}
.header > ul > li{
padding: 0 10px 0 10px;
}
/* CONTENT */
.mainContent{
background: #F10086;
flex: 1 1 auto;
display: flex;
flex-flow: column-reverse;
}
.bottomContent{
width: 100%;
height: 50%;
flex: 1 1 50%;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.topContent{
width: 100%;
height: 50%;
flex: 1 1 50%;
}
.topContent > img{
max-height: 100%;
max-width: 100%;
}
/* TABS */
.tabs{
background: #711A75;
flex: 0 1 18%;
display: flex;
justify-content: space-around;
align-items: center;
}
.tab{
height: 80%;
width: 30%;
background: #180A0A;
border-radius: 15px;
}
</style>
</head>
<body>
<div class="landing">
<div class="header">
<ul>
<li>Test 0</li>
<li>Test 0</li>
<li>Test 0</li>
</ul>
</div>
<div class="mainContent">
<div class="bottomContent">
<h1>Lorem, ipsum dolor.</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum recusandae rem dolorum consectetur repellendus molestiae amet quo reprehenderit possimus eaque.</p>
</div>
<div class="topContent">
<!--<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Vector-based_example.svg/1024px-Vector-based_example.svg.png" alt="circle">-->
</div>
</div>
<div class="tabs">
<div class="tab"></div>
<div class="tab"></div>
<div class="tab"></div>
</div>
</div>
</body>
</html>