Problem Arising from a Custom Button Utilizing the "position: fixed" Property

I have been working on creating a simple webpage with fixed-position buttons at the top that showcase various attributes like hover, box-shadow, and cursor. When hovered over, I want these buttons to display some shading around them. To achieve this, I used the position: fixed attribute within a div tag as a button frame for easy styling across all buttons. However, I encountered an issue where once I scrolled down the page, the attributes (such as hover, box-shadow, and cursor) were no longer applied. I am unsure of how to resolve this problem. Any suggestions?

This is the code block I currently have:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="author" content="User">
        <title>Home Page</title>
        <style>
            body {
                background-color: rgb(255, 255, 255);
                margin: 0px;
                padding: 0px;
                border-style: none;
            }
            .mainFrame {
                position: absolute;
                top: 0px;
                left: 131px;
                width: 700px;
                height: 800px;
                margin: 0px 0px 31px 0px;
                padding: 0px;
                border-style: solid;
                border-color: rgb(0, 0, 0);
                border-width: 0px 2px 2px 2px;
                border-radius: 0px 0px 131px 0px;
            }
            .buttonFrame {
                position: fixed;
                top: 0px;
                left: 133px;
                width: 500px;
                height: 39px;
                margin: 0px;
                padding: 0px;
                border-style: none;
            }
            .button {
                height: 29px;
                margin: 0px;
                padding: 4px 7px 4px 7px;
                background-color: rgb(255, 99, 71);
                border-style: solid;
                border-color: rgb(0, 0, 0);
                border-width: 0px 2px 2px 2px;
                border-radius: 0px 0px 131px 0px;
                font-family: Arial, Helvetica, sans-serif;
                font-weight: bold;
                font-size: 23px;
                text-align: left;
                cursor: pointer;
                outline: none;
            }
            .buttonEffect:hover {
                box-shadow: 0 13px 17px 0 rgba(0,0,0,0.25), 0 13px 17px 0 rgba(0,0,0,0.25);
                outline: none;
            }
            .Home {
                position: absolute;
                top: 0px;
                left: 31px;
                width: 64px;
            }
            .Notes {
                position: absolute;
                top:0 px;
                left: 144px;
                width: 64px;
            }
            .AboutMe {
                position: absolute;
                top: 0px;
                left: 257px;
                width: 105px;
            }
            .contentFrame {
                position: absolute;
                top: 40px;
                left: 0px;
                width: 500px;
                height: 400px;
                margin: 0px;
                padding: 0px;
                border-style: none;
            }
        </style>
    </head>
    <body>
        <div class="mainFrame">
            <div class="buttonFrame">
                <a class="button Home buttonEffect" title="Home">Home</a>
                <a class="button Notes buttonEffect" title="Notes">Notes</a>
                <a class="button AboutMe buttonEffect" title="About Me">About Me</a>
            </div>
            <div class="contentFrame">

            </div>
        </div>
    </body>
</html>

Answer №1

Take out the 'position: absolute' styling from the .contentFrame class

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

Is it possible to populate an input field without first having to select it in HTML or JavaScript?

Is there a way to populate an input field with JavaScript without requiring the user to manually click on it? I want the user to simply type their answer and have it immediately appear in the input field. Here is the HTML code for reference: <input id= ...

My mobile browsing experience is being hindered by a high CLS score due to the image continuously loading late

This is the webpage I am experiencing problems with, and here is the Google Pagespeed report for Mobile. Despite trying to stop lazy loading and preloading the image, there is always a delay in loading. How can this issue be resolved? ...

Insert the picture into an HTML document and retrieve the image file location

I successfully used <input type="file" accept="image/*"> to upload an image and then applied base64 encoding of the image in the onload callback function of a FileReader instance. However, I encountered a problem when trying to assign this base64 enc ...

Sticky DIV stays fixed at the bottom during scrolling without covering the footer section

I need help with making one DIV stick to the bottom of the screen while scrolling, without overlapping the footer. I have tried using fixed bottom but it overlaps the footer. I also attempted to set a higher z-index for the footer, but I would prefer the s ...

Get the index of the currently active element in jQuery, taking into account its position among its original sibling elements

I am implementing a function in jQuery to toggle an 'active' class on elements within a grid. Here is the code snippet: $(".cinema-seats .seat").on("click", function () { $(this).toggleClass("active"); } Essentially, when clicking on random ...

Issue with displaying Vue.js page within iframe in Firefox

We are facing an issue where a Vue.js page with an Echarts pie chart is not displaying in Firefox, even though it shows up perfectly in Chrome and IE. Replacing the Echarts page with basic numbers did not solve the problem in Firefox. Here is how i ...

JavaScript - Load once

I have an issue with my JavaScript code where it loads data multiple times in a loop, causing long wait times. I need to figure out how to load the data only once. After researching the problem, I found some code that may help but I'm not sure how to ...

Modify the currently selected color in a multi-select menu by editing the option tag

Why does the selection option value turn blue, but then become a faint grey when clicking on anything else on the page? Can these colors be changed, especially the faint grey for better accessibility? I've experimented with various CSS approaches, bu ...

How to perfectly center a text box in HTML

UPDATE: I have included the relevant JavaScript code. Essentially, a text box appears when a checkbox is clicked, but I want the text box to be centered on the page. I am attempting to center align a text box on the page, but I am struggling to achieve th ...

Showcasing a div on top of a frame in html

I have a specific requirement where I need to show a div on top of a frame or frameset. Is it achievable to display a div over a frame in an HTML page? ...

Tips on extracting JSON data from an HTML source using BeautifulSoup in Python

In my HTML page, I have a variety of information including: <input class="json-data" id="init-data" type="hidden" value='{"keyboardShortcuts":[{"name":"xxxx","description":"yyyyy", > etc... I am trying to extract something like name = xxxx ...

different ways to dynamically increase CSS ID in PHP

Is there a way to dynamically increment my CSS ID using PHP? foreach ($query_cat->result() as $row_cat) { $row_cat_id = $row_cat->id; echo '<div class="product-wrapper">'; echo '<div id="product-header' . $r ...

What is the method for setting up vertical tabs?

Is it possible for someone to provide guidance on how to create vertical tabs for the HTML content below? When a tab, such as tab1 in the left column, is clicked, only the content of tab1 should be displayed in the middle column. The same applies for tab2 ...

Iterating through a set of HTML elements and making updates using a forEach loop

I have encountered an issue while attempting to update a group of HTML elements within a forEach loop. Initially, everything appears to be functioning correctly up to section 3. However, upon adding a new section, the problem arises where the navigation ba ...

What is the best way to combine a radio button with a dropdown button in Bootstrap?

Hi there, talented developers! I'm attempting to create a design with a combination of radio buttons and dropdown menus using Bootstrap, similar to what is achieved with bootstrap input-group(Buttons with dropdowns). The twist in my design is that i ...

Achieve full height for the span tag within a div using CSS styling

I am facing a particular scenario: In a bootstrap row with 2 columns: - the first column contains a table with a button to add new rows - the second column has a label and a span (although it doesn't have to be a span) Both columns have equal hei ...

Styling text on top of an image using CSS

I am attempting to overlay text on top of an image using the following code: .gallery-image { position: relative; } h2 { position: absolute; top: 200px; left: 0; width: 100%; } h2 span { color: white; font: bold 24px/45px Helvetica, Sans-S ...

Tips on utilizing radio buttons in place of check boxes

How can I create a dynamic menu with multiple categories and submenus that toggle open and close when clicked? I currently have a menu structure with "What's New" and "Categories", and within the "Categories" section, I have three main categories each ...

Which names can be used for HTML form tags in jQuery?

Recently, I encountered an issue related to jQuery form serialization which stemmed from naming a form tag "elements". The problem arose when using jQuery $(’form’).serialize(). Here is an example of the problematic code: <form> <input name=" ...

CSS Resizing the screen leads to misalignment of the footer layout

I am currently working on a page located at However, I have encountered an issue where the footer is not displayed properly when the screen size is changed. Below is the CSS code for the footer: #footer_1 { background: url("../images/bgfooter2.png") ...