Troubleshoot Liquid Design Problem in CSS and JavaScript

I am currently working on creating a website that is similar to another one. The original website uses JavaScript to adjust the padding on the first section in order to keep it within the viewport of the window. I have successfully implemented this feature, but now I am facing an issue with getting the button to move like theirs does when the window size changes.

Check out the video below. Essentially, when I decrease the height (up to a certain point), the button should move upwards. However, on my website, it doesn't move as expected because I haven't been able to figure out how they achieved this effect. The video showcases their CSS and HTML code, and it appears that no values are altered by JavaScript to make the button move. Despite this, the button's position changes while maintaining a padding value of 96 for the element above.

YouTube Video

Edit: My current code looks like this:

<body>
    <div class="container">
        <section id="header" class="arrows" style="padding:280px 0px">
            <header>
                <h1>Mobile Paint Solutions</h1>
                <p>Since 1980</p>
            </header>
            <footer>
                <a onClick="test()" href="" class="button white">About</a>
            </footer>
        </section>
        <section id="banner" class="arrows">
            <header>
                <div>
                    <h1>About Us</h1>
                    <p>We are a proud company and have been providing a superb service for many years. You may read some of our reviews or submit your own below! </p>
                 </div>
            </header>
            <footer>
                <a href="#banner" class="button white">About</a>
            </footer>
        </section>
    </div>
</body>

CSS for the #header:

body {
        text-align:center;
        font-family:'Source Sans Pro', sans-serif;
        letter-spacing: 1px;
        background-image:url(images/bg.jpg);
        padding:0px;
        margin:0px;
    }
    header { margin-bottom: 1em; }
    * { 
        margin:0; 
        padding: 0;
        border: 0;
        font-size: 100%;
        font: inherit;
        vertical-align: baseline;
       }

    /* Header and Title Styles */
    #header {
        display:inline-block;
        text-transform:uppercase;
        color:#FFF;
        cursor:default;
       text-align: center;
   }
   #header header p:before {
       content: '';
        display: block;
        border-top: solid 1px rgba(255, 255, 255, 0.5);
        margin: 4px 0 0.8em 0;
     }
     #header header p {
         border-top:solid 1px rgba(255, 255, 255, 0.5);
        letter-spacing:3px;
        text-transform:uppercase;
        font-size:1em;
        margin-top:1em; 
    }
    #header h1 {
        font-size:2.5em;
        font-weight:bold;
        letter-spacing:3px;
     }
 

Here is a link to their website so you can see the functionality in action.

Answer №1

The problem was resolved by adjusting the footer to have an absolute position and reorganizing some other code, such as setting the header to relative positioning. After making these changes, the issue was successfully fixed.

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

What is the best way to display a changing value within an HTML element?

Let's say I have an Angular 4 component defined as shown below: @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.css'], }) export class HomeComponent implements ...

My code got unexpectedly wrapped in an unnecessary div by Internet Explorer

Oh no, my layout on my aspx page looks totally messed up in IE9! It's perfect in Chrome though: But in IE9, it's all out of whack and looks like this: I finally found out the reason behind this strange display. Apparently IE9 wrapped my "save N ...

How Can I Move My Toggle Button to the Left of My Brand Image/Name in Bootstrap 4.5.0?

My issue is with the toggle button placement, as it always appears slightly to the right of my brand image. The same issue occurs when using a brand name. This is the current layout: https://i.sstatic.net/zdvN0.jpg I would like the toggle to be positione ...

Using JavaScript to effectively handle my JSON data

I've been trying to retrieve the data from my JSON file, but I keep getting an error in the console that says "Uncaught TypeError: Cannot read property 'longitude' of undefined." This method is new to me and I would really appreciate any hel ...

Node.js and Express encountering issues when uploading an image

When testing examples of Express, I encountered an issue with this particular code snippet. Attempting to run the code below (sourced from a website) results in an error when attempting to upload an image: TypeError: Cannot read property 'file' ...

eliminating the existing listener directly from EventM

Let's say I need to create an event listener with ghcjs-dom that triggers on a click and then removes itself. I have addListener :: (IsEventTarget t, IsEvent e) => t -> EventName t e -> SaferEventListener t e -> Bool -> IO ...

Get the value of an input by clicking a button in Javascript and then send a POST

I'm working on a form that has the following structure: <form method="post"> <input type="text" name="username" id="username"> <input type="text" name="password" id="password"> <select id="item" name="item"> ...

Update Personal Information with PHP and MySQL

i have two files named edit.php and update.php. The content of edit.php is as follows: <?php session_start(); $_SESSION['id'] = '9'; $id = $_SESSION["id"]; $username = $_POST["username"]; $fname = $_POST["fname"]; $password = $_POST ...

Simple steps on incorporating a toggler button to collapse the header using Bootstrap

As a beginner in web development, I am facing challenges adding the collapse toggler to my code. I have tried various methods but have not been successful. Can someone please provide assistance? Below is the code snippet: <body> <div clas ...

Attempting to organize date and time down to the second

I'm currently working on sorting time with seconds included. While I am able to sort the minutes successfully, I'm facing difficulty in sorting the seconds. Despite trying various approaches and using dynamic data that needs to be sorted in desce ...

Once map layers have been loaded initially, they will not render again

I'm currently incorporating Mapbox GL into my Vue project using VueMapbox (0.4.1). <template> <MglMap :accessToken="accessToken" :mapStyle.sync="mapStyle" :repaint="true" @load="onMapLoaded ...

Extract the value/values enclosed within double quotation marks using a regular expression

Struggling to create a JavaScript form validator; The value follows a specific format and can appear one or more times. When testing the value, it is crucial to ensure that the entered value is enclosed within double quotes. For example: one value: "C:GS ...

Comparing the Number of Object Properties in Arrays: Quality over Quantity

I am creating detailed character descriptions that are rich in strings using the character object below. Efficiency is a key factor for me, as I am aware that arrays with lengthy strings can become top-heavy quickly. Assuming that properties can be accesse ...

Implement the scope change in an Angular controller by utilizing controllerAs functionality

I am facing an issue with my controller setup as shown below: angular .module('app.core') .controller('TestController', TestController); TestController.$inject = ['$timeout', '$interval']; function TestControl ...

Ways to eliminate line breaks in CSS

I'm currently working on a project and I'm facing an issue with text auto-entering without using any breaks. I'm not sure what the exact problem is. I implemented a code snippet from Overstack to display a div on hover. Perhaps the positioni ...

The div is set to a position of absolute, causing the overflow-y property to be set to auto. As a

I am facing an issue with a div that has absolute positioning nested inside other divs. If you take a look at the code snippet below from http://jsfiddle.net/d8GYk/, you'll notice the styling properties applied to the div. <div style="position: ...

Positioning the Iframe directly beneath the header

Hey there, I have this little issue that's been bugging me. In my index page, I've included the header.php, followed by an Iframe. <body> <?php include 'header.html' ?> <div class="clear"></div> ...

What is the best way to align this rendered Django template in the center using Bootstrap?

In previous tutorials, it was mentioned that divs with the "container" class in Bootstrap are supposed to automatically center. However, I am experiencing issues with this in the current version. <!DOCTYPE html> <html lang="en" dir="ltr> & ...

Unable to get the deletion functionality to work for Dropzone.js and PHP script

I am currently using dropzone to handle file uploads. My goal is to delete the files on the server when the user clicks on the removeLink. I have implemented an Ajax function that calls a .php site for this purpose. However, I am facing an issue where I am ...

Having trouble with try/catch blocks in Express.js?

While working on creating a route in express.js with a try/catch block, I encountered an issue where the code would load without returning any value when the conditions in the try block are not met. Has anyone found a solution for this problem? app.post(& ...