I have a page made with plain html, css, and javascript that is completely responsive horizontally. It is only when I start shrinking the page vertically that I start to run into issues. Reason being because my page structure is a bit unorthodox. How my page works is that it’s divided into four parent containers with a height of 100%. Upon shrinking the page vertically, those containers’ items will start to overflow since the four parent containers are trying to keep the height of the window. The simple fix would be to add a min-height to these parent containers so before the items are able to overflow, the parent containers stop scaling to the height of the window. However, this leaves me with one problem. The items in the parent container get smaller and also change their layout upon shrinking the width of the window. So if I set the min-height of the parent container to a fixed value that would leave its items mere pixels from overflowing, all of a sudden, if the width of the page window changes that fixed value will no longer work anymore since the items are constantly changing sizes depending on the width of the window. Thus changing what size the parent container will be before the items will overflow. What would be the best way to solve this problem and get a responsive min-height? If this issue can be resolved, my page will be completely responsive. Thanks in advance; any reply is greatly appreciated!
Here is the codepen to my page: https://codepen.io/COMMANDERY11/pen/Vwqjpwv
Just to clarify, my code is just slightly different from how I described it above. Basically my code does have the four parent containers, but in those parent containers is another container that takes up 90% of the width and height of the parent. This is because I want a cool video border effect. To do that, the parent container simply has a video/gif as its background and the container within that has the 90% width and height has a white background. The items are in this white container. I’ve tried using a min-height of 100% on the white container and give it a height of fit-content + Xpx but the borders of the backing video on its parent seem to vanish upon shrinking.
<!DOCTYPE html>
<html>
<head>
<title>Adam's Website - Creative Design</title>
<link rel="stylesheet" href="./creative_design.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Barlow:wght@300&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Anton&display=swap" rel="stylesheet">
</head>
<body>
<div class="navbar">
<a href="./home.html">
<img class="navbar_logo" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTa7bzddXqTB3wiGP7mDgrof4mdzWEfjVkXOg&usqp=CAU"/>
</a>
<div class="navbar_buttons">
<button class="blue_button">Sign Up</button>
<button class="blue_button">Log In</button>
</div>
</div>
<div id="site_redesign" class="personal_package_division">
<img src="https://media.tenor.com/sorHkexPZDwAAAAC/particles.gif" class="personal_package_division_backing_video"></img>
<div class="personal_package_white_container">
<div class="site_redesign_description fade_in">
<h2 class="personal_package_description_header">New traffic strategy?</h2>
<p class="personal_package_description_paragraph">Team up with a top<br> SEO specialist.<br> Expand your network,<br> create new paths, and grow your brand.</p>
</div>
<div class="site_redesign_functionality">
<h1 class="personal_package_title">Site Re-design</h1>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTa7bzddXqTB3wiGP7mDgrof4mdzWEfjVkXOg&usqp=CAU"/>
<div class="button_group">
<button class="blue_button">Full Site</button>
<button class="blue_button">One Pager</button>
</div>
</div>
<div class="ad">
</div>
</div>
</div>
<div id="creative_consultations" class="personal_package_division">
<img src="https://media.tenor.com/sorHkexPZDwAAAAC/particles.gif" class="personal_package_division_backing_video"></img>
<div class="personal_package_white_container">
<div class="creative_consultations_description fade_in">
<h2 class="personal_package_description_header">Writer's block wizard!</h2>
<p class="personal_package_description_paragraph">With the endless supply of creativity<br> we can get to the core<br> story, personalize, internalize<br> and create.</p>
</div>
<div class="creative_consultations_functionality">
<h1 class="personal_package_title">Creative Consultations</h1>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTa7bzddXqTB3wiGP7mDgrof4mdzWEfjVkXOg&usqp=CAU"/>
<div class="button_group">
<button class="blue_button">Contact Me</button>
</div>
</div>
<div class="ad">
</div>
</div>
</div>
<div id="asset_creation" class="personal_package_division">
<img src="https://media.tenor.com/sorHkexPZDwAAAAC/particles.gif" class="personal_package_division_backing_video"></img>
<div class="personal_package_white_container">
<div class="asset_creation_description fade_in">
<h2 class="personal_package_description_header">Mind the gap.</h2>
<p class="personal_package_description_paragraph">Pick your custom asset team or individual.<br> The high quality asset creators are for<br> your every day projects,<br> although on an on call schedule.</p>
</div>
<div class="asset_creation_functionality">
<h1 class="personal_package_title">Asset Creation</h1>
<div class="asset_creation_slider">
<div class="asset_creation_slides">
<input type="radio" name="radio-btn" id="asset_creation_radio1">
<input type="radio" name="radio-btn" id="asset_creation_radio2">
<input type="radio" name="radio-btn" id="asset_creation_radio3">
<div class="asset_creation_slide first">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTa7bzddXqTB3wiGP7mDgrof4mdzWEfjVkXOg&usqp=CAU" alt="">
</div>
<div class="asset_creation_slide">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTa7bzddXqTB3wiGP7mDgrof4mdzWEfjVkXOg&usqp=CAU" alt="">
</div>
<div class="asset_creation_slide">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTa7bzddXqTB3wiGP7mDgrof4mdzWEfjVkXOg&usqp=CAU" alt="">
</div>
</div>
<div class="asset_creation_navigation-manual">
<label for="asset_creation_radio1" class="manual-btn"></label>
<label for="asset_creation_radio2" class="manual-btn"></label>
<label for="asset_creation_radio3" class="manual-btn"></label>
</div>
</div>
<div class="button_group">
<button class="blue_button">N/A</button>
<button class="blue_button">N/A</button>
</div>
</div>
<div class="ad">
</div>
</div>
</div>
<div id="no_code_websites" class="personal_package_division">
<img src="https://media.tenor.com/sorHkexPZDwAAAAC/particles.gif" class="personal_package_division_backing_video"></img>
<div class="personal_package_white_container">
<div class="no_code_websites_description fade_in">
<h2 class="personal_package_description_header">Platform for brands.</h2>
<p class="personal_package_description_paragraph">Minimum 5 pages of your creative choice,<br> a few creative design meetings,<br> complete access, security and control,<br> and a free 1 year domain in your name.</p>
</div>
<div class="no_code_websites_functionality">
<h1 class="personal_package_title">No-Code Websites</h1>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTa7bzddXqTB3wiGP7mDgrof4mdzWEfjVkXOg&usqp=CAU"/>
<div class="button_group">
<button class="blue_button">N/A</button>
<button class="blue_button example_website_button">Example Website</button>
<button class="blue_button">N/A</button>
</div>
</div>
<div class="ad">
</div>
</div>
</div>
<script type="text/javascript" src="C:UsersizayaOneDriveDocumentsHTML DocumentsMy ProjectsAdam's WebsiteAdamsWebsiteReposcript.js" defer></script>
<body>
</html>
/*Base Code*/
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: "Barlow", sans-serif;
font-weight: bold;
color: black;
scroll-behavior: smooth;
border: 1px blue solid;
}
html {
width: 100%;
height: 100%;
overflow: hidden;
}
body {
width: 100%;
height: 100%;
overflow: auto;
}
img {
width: 100%;
}
/*Utility Classes*/
.fade_in {
opacity: 0;
transition: opacity 750ms ease-in;
}
.fade_in.appear {
opacity: 1;
}
.personal_package_division {
flex-grow: 1;
flex-shrink: 0;
padding: 1rem;
flex-direction: column;
display: flex;
position: relative;
width: 100%;
height: 100%;
min-height: 800px;
scroll-snap-align: start;
}
.personal_package_division_backing_video {
position: absolute;
top: 0;
left: 0;
-o-object-fit: cover;
object-fit: cover;
width: 100%;
height: 100%;
z-index: -1;
}
.personal_package_white_container {
margin: auto;
flex-shrink: 0;
padding: 1rem;
background-color: white;
display: flex;
align-items: center;
justify-content: space-evenly;
text-align: center;
width: 95%;
height: 95%;
}
.personal_package_description_header {
font-size: clamp(2.5rem, 2.5vw, 3rem);
}
.personal_package_description_paragraph {
font-size: clamp(1.4rem, 1.25vw, 1.5rem);
}
.personal_package_title {
font-family: "Anton", sans-serif;
font-size: clamp(2rem, 4.5vw, 5rem);
}
.button_group {
display: flex;
width: 100%;
justify-content: space-between;
}
.blue_button {
background-color: #b8eefc;
border-radius: 6px;
font-family: "Barlow", sans-serif;
font-weight: bold;
font-size: clamp(0.9rem, 1.5vw, 1.1rem);
padding: 1em 1.25em;
transition-duration: 0.2s;
}
.blue_button:hover {
font-size: 1.25rem;
background-color: white;
cursor: pointer;
box-shadow: 0 12px 16px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19);
}
.ad {
width: clamp(200px, 20%, 400px);
aspect-ratio: 4/8;
}
/*Navbar*/
.navbar {
width: 100%;
display: flex;
justify-content: space-between;
position: fixed;
align-items: center;
top: 0;
left: 0;
z-index: 999;
padding: 0% 5%;
pointer-events: none;
}
.navbar_logo {
width: clamp(70px, 10vw, 90px);
transition-duration: 0.2s;
pointer-events: auto;
}
.navbar_logo:hover {
width: clamp(80px, 12.5vw, 100px);
cursor: pointer;
}
.navbar_buttons {
display: flex;
justify-content: space-between;
align-items: center;
pointer-events: auto;
gap: 50px;
}
/*Site Redesign*/
.site_redesign_functionality {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
width: clamp(200px, 40%, 800px);
gap: 30px;
}
/*Creative Consultations*/
#creative_consultations .personal_package_division_backing_video {
transform: scaleY(-1);
}
.creative_consultations_functionality {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
width: clamp(200px, 30%, 500px);
gap: 30px;
}
.creative_consultations_functionality .blue_button {
width: 100%;
}
/*Asset Creation*/
.asset_creation_functionality {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
width: clamp(400px, 40%, 800px);
gap: 50px;
}
.asset_creation_slider {
position: relative;
width: 100%;
border-radius: 10px;
overflow: hidden;
}
.asset_creation_slides {
width: 500%;
display: flex;
}
.asset_creation_slides input {
display: none;
}
.asset_creation_slide {
width: 20%;
transition: 2s;
}
.asset_creation_slide img {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
}
/*Manual Carosel Navigation*/
.asset_creation_navigation-manual {
position: absolute;
width: 100%;
margin-top: -40px;
display: flex;
justify-content: center;
}
.manual-btn {
border: 2px solid black;
padding: 5px;
border-radius: 10px;
cursor: pointer;
transition: 1s;
}
.manual-btn:not(:last-child) {
margin-right: 40px;
}
.manual-btn:hover {
background: black;
}
#asset_creation_radio1:checked ~ .first {
margin-left: 0;
}
#asset_creation_radio2:checked ~ .first {
margin-left: -20%;
}
#asset_creation_radio3:checked ~ .first {
margin-left: -40%;
}
/*No Code Websites*/
#no_code_websites .personal_package_division_backing_video {
transform: scaleY(-1);
}
.no_code_websites_functionality {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
width: clamp(400px, 50%, 1000px);
gap: 30px;
}
.no_code_websites_functionality .example_website_button {
background-color: #ca74fc;
}
.no_code_websites_functionality .example_website_button:hover {
background-color: white;
}
@media (max-width: 1280px) {
/*Site Redesign Responsiveness*/
#site_redesign .personal_package_white_container {
display: grid;
grid-template-columns: clamp(300px, 60%, 700px) clamp(200px, 30%, 350px);
justify-content: center;
align-content: center;
grid-template-areas: "functionality ads" "description ads";
grid-gap: 20px;
}
#site_redesign .personal_package_white_container .ad {
grid-area: ads;
width: 100%;
height: 100%;
}
.site_redesign_functionality {
width: 100%;
grid-area: functionality;
gap: 20px;
}
.site_redesign_functionality .personal_package_title {
font-size: clamp(3rem, 6vw, 4.25rem);
}
.site_redesign_description {
grid-area: description;
}
.site_redesign_description .personal_package_description_header {
font-size: clamp(2rem, 3.75vw, 2.5rem);
}
.site_redesign_description .personal_package_description_paragraph {
font-size: clamp(1.15rem, 2vw, 1.25rem);
}
/*Creative Consultations Responsiveness*/
#creative_consultations .personal_package_white_container {
display: grid;
grid-template-columns: clamp(200px, 50%, 600px) clamp(200px, 30%, 350px);
justify-content: center;
align-content: center;
grid-template-areas: "functionality description" "functionality ads";
grid-gap: 20px;
}
#creative_consultations .personal_package_white_container .ad {
grid-area: ads;
width: 100%;
height: 100%;
}
.creative_consultations_functionality {
grid-area: functionality;
width: 100%;
height: 100%;
gap: 20px;
}
.creative_consultations_functionality .personal_package_title {
font-size: clamp(3rem, 6vw, 4.25rem);
}
.creative_consultations_description {
grid-area: description;
}
.creative_consultations_description .personal_package_description_header {
font-size: clamp(2rem, 3.75vw, 2.5rem);
}
.creative_consultations_description .personal_package_description_paragraph {
font-size: clamp(1.15rem, 2vw, 1.25rem);
}
/*Asset Creation Responsiveness*/
#asset_creation .personal_package_white_container {
display: grid;
grid-template-columns: clamp(300px, 60%, 700px) clamp(200px, 30%, 350px);
justify-content: center;
align-content: center;
grid-template-areas: "functionality ads" "description ads";
grid-gap: 20px;
}
#asset_creation .personal_package_white_container .ad {
grid-area: ads;
width: 100%;
height: 100%;
}
.asset_creation_functionality {
width: 100%;
grid-area: functionality;
gap: 20px;
}
.asset_creation_functionality .personal_package_title {
font-size: clamp(3rem, 6vw, 4.25rem);
}
.asset_creation_description {
grid-area: description;
}
.asset_creation_description .personal_package_description_header {
font-size: clamp(2rem, 3.75vw, 2.5rem);
}
.asset_creation_description .personal_package_description_paragraph {
font-size: clamp(1.15rem, 2vw, 1.25rem);
}
/*No Code Websites Responsiveness*/
#no_code_websites .personal_package_white_container {
display: grid;
grid-template-columns: clamp(300px, 60%, 700px) clamp(200px, 30%, 350px);
justify-content: center;
align-content: center;
grid-template-areas: "functionality ads" "description ads";
grid-gap: 20px;
}
#no_code_websites .personal_package_white_container .ad {
grid-area: ads;
width: 100%;
height: 100%;
}
.no_code_websites_functionality {
width: 100%;
grid-area: functionality;
gap: 20px;
}
.no_code_websites_functionality .personal_package_title {
font-size: clamp(3rem, 6vw, 4.25rem);
}
.no_code_websites_description {
grid-area: description;
}
.no_code_websites_description .personal_package_description_header {
font-size: clamp(2rem, 3.75vw, 2.5rem);
}
.no_code_websites_description .personal_package_description_paragraph {
font-size: clamp(1.15rem, 2vw, 1.25rem);
}
}
@media (max-width: 640px) {
.navbar_buttons {
width: 180px;
gap: 0px;
}
.personal_package_division {
padding: 1% auto;
}
/*Site Redesign Responsiveness Phone*/
#site_redesign .personal_package_white_container {
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
text-align: center;
}
#site_redesign .personal_package_white_container .ad {
order: 3;
width: 90%;
min-height: 125px;
max-height: 175px;
}
.site_redesign_functionality {
order: 1;
width: 90%;
gap: 25px;
}
.site_redesign_functionality .personal_package_title {
font-size: clamp(2rem, 10vw, 4rem);
}
.site_redesign_description {
order: 2;
}
.site_redesign_description .personal_package_description_header {
font-size: clamp(1.5rem, 8vw, 2.25rem);
}
.site_redesign_description .personal_package_description_paragraph {
font-size: clamp(0.9rem, 4vw, 1.15rem);
}
/*Creative Consultations Responsiveness Phone*/
#creative_consultations .personal_package_white_container {
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
text-align: center;
}
#creative_consultations .personal_package_white_container .ad {
order: 3;
width: 90%;
min-height: 125px;
max-height: 175px;
}
.creative_consultations_functionality {
order: 1;
width: 75%;
gap: 25px;
}
.creative_consultations_functionality .personal_package_title {
font-size: clamp(2rem, 10vw, 4rem);
}
.creative_consultations_description {
order: 2;
}
.creative_consultations_description .personal_package_description_header {
font-size: clamp(1.5rem, 8vw, 2.25rem);
}
.creative_consultations_description .personal_package_description_paragraph {
font-size: clamp(0.9rem, 4vw, 1.15rem);
}
/*Asset Creation Responsiveness Phone*/
#asset_creation .personal_package_white_container {
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
text-align: center;
}
#asset_creation .personal_package_white_container .ad {
order: 3;
width: 90%;
min-height: 125px;
max-height: 175px;
}
.asset_creation_functionality {
order: 1;
width: 90%;
gap: 25px;
}
.asset_creation_functionality .personal_package_title {
font-size: clamp(2rem, 10vw, 4rem);
}
.asset_creation_description {
order: 2;
}
.asset_creation_description .personal_package_description_header {
font-size: clamp(1.5rem, 8vw, 2.25rem);
}
.asset_creation_description .personal_package_description_paragraph {
font-size: clamp(0.9rem, 4vw, 1.15rem);
}
/*No Code Websites Responsiveness Phone*/
#no_code_websites .personal_package_white_container {
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
text-align: center;
}
#no_code_websites .personal_package_white_container .ad {
order: 3;
width: 90%;
min-height: 125px;
max-height: 175px;
}
.no_code_websites_functionality {
order: 1;
width: 90%;
gap: 25px;
}
.no_code_websites_functionality .personal_package_title {
font-size: clamp(2rem, 10vw, 4rem);
}
.no_code_websites_functionality .button_group {
flex-direction: column;
gap: 10px;
}
.no_code_websites_description {
order: 2;
}
.no_code_websites_description .personal_package_description_header {
font-size: clamp(1.5rem, 8vw, 2.25rem);
}
.no_code_websites_description .personal_package_description_paragraph {
font-size: clamp(0.9rem, 4vw, 1.15rem);
}
}/*# sourceMappingURL=creative_design.css.map */