What are some ways I can ensure my webpage remains consistent and user-friendly when scrolling, rather than appearing distorted and jumbled?

Is there a way to automatically scroll my page when the window is at a small height, instead of adjusting it to the height by squeezing it? I've tried using overflow in different ways, but haven't been successful in getting the entire page to scroll no matter where I place it. The codepen link can be found here: CODEPEN. Thank you for any help!

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Oleo+Script&display=swap');


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-y: scroll;
}

a {
    color: #8524C6;
    text-decoration: none;
}

section {
    width: 100%;
    height: 100vh;
    color: #fff;
    background: linear-gradient(-45deg, #F5D0E4, #F6D5F2, #EAD5F6, #D9D5F6, #D5E1F6, #D5ECF6);
    background-size: 400% 400%;
    position: relative;
    animation: change 10s ease-in-out infinite;
    overflow: hidden;
    align-items: center;
    justify-content: center;
} 

h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.3em;
    font-family: 'Oleo Script', cursive, 'Helvetica', sans-serif;
    letter-spacing: .07rem;
    transform: translateY(15vh);
}

h1 span {
    display: flex;
    text-align: center;
    vertical-align: middle;
}

h1:hover span {
    animation: animate .5s infinite;
}

@keyframes animate {
    0% {
        transform: translateY(0)
    }
    50% {
        transform: translateY(-30px)
    }
    100% {
        transform: translateY(0)
    }
}

h1 span:nth-child(1) {
    animation-delay: 0s;
}
h1 span:nth-child(2) {
    animation-delay: .1s;
}
h1 span:nth-child(3) {
    animation-delay: .2s;
}

h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: top;
    color: #000;
    font-size: .4rem;
    font-family: 'Press Start 2P', cursive, serif;
    text-transform: uppercase;
    transform: translateY(15.5vh)
}

.dancing-hamsters {
    display: flex;
    position: relative;
    margin: auto;
    align-content: center;
    width: 100%;
    height: 1.3rem;
    width: 5.1rem;
    transform: translateY(18vh);
    z-index: 1;
}

.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #d3d3d3;
    align-content: center;
    position: absolute;
    top: 50%;
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 50%;
    padding: 5px;
    padding-right: 3%;
    box-shadow: inset 0 0 10px #000;
}


.top-note {
    /* display: flex; */
    display: none;
    font-family: 'Helvetica', sans-serif;
    font-size: .65rem;
    text-align: center;
    justify-content: center;
    align-items: center;
    color: #000;
    transform: translate(4%, -5%);
}



.box {
    display: flex;
    flex-direction: column;
    background-color: #d3d3d3;
    text-align: center;
    justify-content: center;
    align-items: center;
    text-align: center;
    transform: translateX(50%);
    width: 1rem;
    height: 1rem;
    font-family: 'Press Start 2P', cursive, serif;
    font-size: .5rem;
    margin: 2rem;
}

img {   
    display: flex;
    width: 85%;
    height: 75%;
}

.container img {
    cursor: url('https://i.postimg.cc/6338xsj2/oie-nr-M8-Ct-Mr-SPb-H.png'), auto;
}

.box-text {
    margin-top: 10%;
    cursor: url('https://i.postimg.cc/6338xsj2/oie-nr-M8-Ct-Mr-SPb-H.png'), auto;
}

.nav {
    margin: auto;
    text-align: center;
    transform: translateY(70vh);
    font-size: .5rem;
    text-transform: uppercase;
    line-height: .8rem;
}

.nav a {
    color: #000;
    font-family: 'Press Start 2P', cursive, serif;
    text-shadow: 2px 2px 7px #8524C6;
}


footer {
    margin: auto;
    width: 100%;
    height: 1rem;
    font-family: Helvetica, sans-serif;
    font-size: .75rem;
    background-color: transparent;
    border-top: 1px solid #fff;
    text-align: center;
    padding-top: 1rem;
    bottom: 0;
    transform: translateY(80vh);
}

@keyframes change {
    0% {
        background-position: 0 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

/* Media Queries */

@media screen and (min-width: 740px) {

    h1 {
        font-size: 3em;
        transform: translateY(8vh);
        word-spacing: 2em;
    }

    h2 {
        font-size: 1rem;
        transform: translateY(8vh);
    }

    .dancing-hamsters {
        height: 2rem;
        width: 9rem;
        transform: translateY(10.5vh);
    }

    .container {
        display: flex;
        flex-direction: row;
        }

    .top-note {
        display: none;
    }

    .box {
        width: 15rem;
        height: 15rem;
        transform: translateX(15%);
        font-size: .75rem;
       }
    
    .img {
         width: 100%;
         height: 100%;
        }

    .nav li {
            margin: .5em;
            display: inline;
            text-align: center;
            align-items: center;
            justify-content: center;
            font-size: .85rem;
            }
    .nav {
        transform: translateY(64vh);
    }

    footer {
        transform: translateY(75vh);
    }
}

Answer №1

An efficient fix would be to incorporate the use of min-height in the primary section element:

section {
    width: 100%;
    height: 100vh;
    min-height: 500px; // Demonstrative addition of 500px
    color: #fff;
    background: linear-gradient(-45deg, #F5D0E4, #F6D5F2, #EAD5F6, #D9D5F6, #D5E1F6, #D5ECF6);
    background-size: 400% 400%;
    position: relative;
    animation: change 10s ease-in-out infinite;
    overflow: hidden;
    align-items: center;
    justify-content: center;
} 

While you've defined the section's height, integrating min-height ensures that your content won't shrink below the set value regardless of screen size.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Adjust the styling of the anchor tag within the selected div by utilizing jQuery

I am struggling with changing the color of a specific anchor tag when clicked inside a div with class .product_wishlist. Currently, all anchor tags within .pw div are changing colors. Is there a way to apply selected css only to the clicked element? Any he ...

Activate a tooltip on the button depending on the value entered in the search field

I need to display a tooltip on the button when the search field is empty. Here is what I have attempted: // Enable hover feature const searchBtn = document.querySelector('.find__btn'); searchBtn.addEventListener('mouseover', () => ...

What is the most effective method for locating and capturing a specific element (such as an input box) in Python Selenium using either Xpath or CSS selector

I am currently using selenium to scrape a website, primarily relying on xpath or CSS selectors to extract elements. However, I have noticed that these selectors are dynamic, which contradicts what I have read online about CSS selectors being stable. As a b ...

Image not showing up on HTML page following navigation integration

Having trouble with my responsive website setup - the background image for ".hero-image" isn't showing up after adding the navigation. Google Chrome console is throwing a "Failed to load resource: the server responded with a status of 404 (Not Found)" ...

Creating space between flex items in Slick Carousel with Vue

This is my current Slick Carousel. There are 4 items in a row, and I am looking to insert some margin between each item while maintaining the existing aspect-ratio: 1.3/1; I'm struggling with overriding the classes from vue-slick-carousel. Does any ...

Ways to ensure a ul li element perfectly fits inside a div element without any spaces

As a newcomer to CSS and HTML, I'm facing an issue with my ul li dropdown menu and login boxes. The background colors are red and blue, but there are gaps within the div that I want to fill with the height of the div. Below is the code snippet: @key ...

Issue with changing the height of a textarea in a mobile browser when it is

I'm currently facing an issue specific to mobile devices that I have also encountered on Google Chrome (even when using the developer tools in mobile view). The problem is quite straightforward. There is a simple form on the website, consisting of a ...

Triggering a specific outcome with every user interaction involving the selection of an element

How can I trigger this effect each time the user clicks on the element using jQuery? I have added a "ripple" class upon clicking, but when I click on the element for the second time, the effect does not execute because the class has already been added. Ho ...

Issue with unordered list in the footer overlapping other elements

I've been struggling to resolve an issue with my footer for quite some time now. The problem seems to be arising from my unordered list being set to float right, causing it to overflow the parent div. Could someone please shed light on what I might b ...

The issue of responsive spacing (such as mb-lg-2 mb-sm-3, etc) not functioning as expected has been identified in Bootstrap

Previously in Bootstrap 4, these classes were effective. However, I am finding that they are not functioning properly in Bootstrap 5. Any insights as to why this might be happening? Note: d-block d-lg-flex , text-center text-lg-start text-md-end seem to s ...

Error occurs when SRCSET loads the wrong size because "sizes" parameter is missing

According to the guidelines, when sizes is not specified in the image attribute, the browser should automatically calculate the required size based on CSS rendering. In this scenario, my image is 300px and the browser should select the 300px image. Howeve ...

Excess space creating horizontal and vertical scrolling issues on an HTML webpage

Currently, I am experimenting with CSS effects. In my code, I have included div elements to display balls on the document body, each with random sizes and colors. However, an unexpected issue has arisen - excess scroll space is being generated due to the c ...

Issues with implementing CSS Icon Generated Content on a live Azure Web Role

My dilemma lies with my MVC4 web application that I'm attempting to deploy as an Azure web role. The site incorporates Metro UI CSS. While the deployed web role is functioning properly overall, I am encountering an issue with the CSS-generated conten ...

Issue with jquery curvy corners not functioning properly on Internet Explorer 8

Check out my website at If you view the page in IE8 and then in IE7 compatibility mode, you'll notice a strange issue. The box on the right disappears in IE8 but displays perfectly rounded corners in IE7. I am currently using the jQuery Curvy Corner ...

What steps can be taken to create a curved bottom for the header section?

While I've seen this question asked before, I'm not satisfied with how the design has been implemented. Here is my desired look for the curved header I've experimented with border radius left and right, but the edges are excessively rounde ...

Changing the Values of Variables in an npm Package within SvelteKit

I have been working on a SvelteKit component library where I define variables for components like background-color and font-family in a CSS file. Inside the ./dist/index.js file of my library, I export the CSS using `import './main.css'`. When in ...

Replace the pixel measurements with percentage values

I have a vision for creating a dynamic full-width slider using a flex-wrapper and multiple child sections. Each section spans the width of the viewport and is aligned in a row. The goal is to move the flex-wrapper by 100% margin-left every time a button ...

Converting line breaks into a visible string format within Angular

After thorough research, all I've come across are solutions that demonstrate how to display the newline character as a new line. I specifically aim to exhibit the "\n" as a string within an Angular view. It appears that Angular disrega ...

Prevent the propagation of a particular CSS class's inheritance

I need to make modifications to an existing HTML5 app that features two unique themes. Here's an example of the current structure: <body class="theme1 theme2"> <div id="div1">I'm satisfied with both themes</div> <di ...

How to keep a div element fixed on the page's border vertically and horizontally adhered

Would you mind visiting the following link: and observing the layout of the page? My goal is to affix or "attach" a small div element to the right side of the page, just slightly outside of the right frame of the page. Vertically, I want this div to be ...