The sticky navigation bar allows for the overlapping of additional div elements

Here is the HTML AND SCSS(SASS) code for a NAVBAR:

<div id="navbar">
            <ul>
                <li><a href="#home">Home</a></li>
                <li><a href="#main">Main</a></li>
                <li><a href="#bedroom">Bedroom</a></li>
                <li><a href="#living-room">Living Room</a></li>
                <li><a href="#bathroom">Bathroom</a></li>
                <li><a href="#kitchen">Kitchen</a></li>
                <li><a href="#others">Others</a></li>
            </ul>
    </div>
#navbar{
    position: fixed;
    top: 0;
    height: 4rem;
    width: 100%;
    background-color: $dark-color1;

    ul{
        display: flex;
        justify-content: center;
        justify-content: space-between;
        padding: 0 3rem;
        background:$dark-color2;
        text-align: center;
        align-items: center;

    }
    li{
        display: flex;
        font-size: 1.3rem;     

    }

    a{
        color: $light-color1;
        text-decoration: none;
        list-style: none;
        padding: 20px;
    }

    a:hover{
        background-color: $light-color2;
        color: $dark-color2;
    }
}

When I add other div elements below the navbar, such as the bedroom div shown below:


<div id="bedroom" class = "room">
                <p class = "title"> Bedroom</p>
                <div class="flooring-tile">
                    <label for="Flooring-tile">Flooring Tile</label>
                    <input type="checkbox">
                </div>
                <div class="flooring-carpet">
                    <p class = "pname">Flooring Carpet</p>
                    <label for="Replacement">Replacement</label>
                    <input type="checkbox">
                    <label for="Powerclean">Powerclean</label>
                    <input type="checkbox">
}

the Bedroom div tends to overlap with the navbar. I want to create a page where there is no scrolling (overflow: hidden) and the user should only navigate using the scroll bar.

However, since the content of #bedroom is hiding behind the navbar, I am unable to align the pages properly.

Answer №1

Utilizing the CSS property position: absolute; could be beneficial in organizing the elements within your navigation bar. The use of absolute aligns well with the div element you've incorporated, creating a seamless flow of content. For more information on CSS positioning, you can refer to this helpful resource.

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

Choosing the type attribute of an input tag by using a javascript variable as a condition: What's the best approach?

I am currently utilizing an input tag on the client side to receive text input. <input type="text" class="form-control" placeholder="Enter Message" id="messageText" autofocus/> My goal now is to dynamically set the type attribute based on a Javasc ...

updating numerous div elements using the jQuery load function

My SQL database contains various data, and on my webpage, I have numerous divs (around 30) showcasing this information. Each div corresponds to a different value in the database. My goal is to dynamically refresh these divs using the jQuery item.load() f ...

Storing the CSS styling for a unique directive in its own dedicated file

Currently exploring Angular and seeking guidance on the most effective methods, as well as a general roadmap for delving deeper into the topic: In my efforts to develop a web application with Angular consisting of various independent widgets, I have opted ...

The svg line is drawn with a width that is half of the specified width

I am looking to create a horizontal line that is 10px wide. I tried using the code below <svg width="500" > <line x1="100" x2="460" y1="0" y2="0" stroke="red" stroke-width="10px&qu ...

Conceal column exclusively on smaller displays using Bootstrap 4

I want to design a grid that covers the whole screen with 3 columns (left, middle, right) Left: This column should only be displayed on large views and occupy 16.6% of the screen (2/12) Middle: This column should always be visible. It should take up 75% ...

Is it possible that using vim omni-complete will remove the word that I had previously selected

When writing HTML with gvim, I find it frustrating that the omni-complete feature always deletes my previous word and even my previously selected ones. For example, let's say I'm in the middle of writing the following code**('_' indica ...

Struggling to align materialUI input or textfield horizontally

import {Input} from 'material-ui'; import Select from 'react-select'; I've been trying different ways to adjust the margins and padding, even wrapping them in divs, but I can't seem to get Material UI textfield or input alig ...

Adding Items to the Beginning of a Drop-down List using jQuery.prepend

I have created a select list for various types of restaurants. Users can choose a food type, click search, and receive a list of restaurants specializing in that particular cuisine. To add an initial option to the select dropdown, I used the following cod ...

Is there a way to arrange the navigation items to appear on the right side upon toggler click?

I've been trying to get the nav-items to align on the right side, but so far using the ms-auto class from Bootstrap isn't giving me the desired result. <html lang="en"> <head> <!-- Required meta tags --> < ...

"Encountering a 'ngRoute' reference issue

My attempt to use a controller to fetch a JSON file is resulting in the following error message: "Failed to instantiate module getJson due to: Error: [$injector:nomod] http://errors.angularjs.org/1.2.23/$injector/nomod?p0=get..." I keep encountering ...

The mouseover and mouseleave functions remain active even during window resizing

I wish to create a dynamic menu that appears when hovering over a user, but only if the window size is above 977 pixels. Take a look at my code below: $(document).ready(function() { $(window).on("load resize", function(event){ var windowS ...

Use JavaScript to add a div element to the page ten times every time the button is clicked

Here is the code I have written: $(document).ready(function () { $('<button class="btn more">View More</button>') .appendTo(".listing-item-container") .click(function() { $(this).closest(". ...

What is the best way to ensure that these social icons are perfectly centered on the page across all web browsers?

Visit my website here: foxweb.marist.edu/users/kf79g/contact.php I'm stuck on the final step needed to deploy my website and finish it. The issue I'm facing is with the social icons when viewed on medium and small screens. I want them to be cent ...

Leveraging moment.format Function in Angular within an HTML Context

Is there a way to implement the moment.format method in HTML? Currently, I am utilizing the toLocaleDateString method to showcase an array of dates: <ng-template let-event> <div>{{event.date.toLocaleDateString(' ...

JavaScript form with radio buttons

I'm completely new to JavaScript and I'm attempting to create a basic script that will show one form when a radio button is checked, and another form when the second radio button is clicked (with no form displayed when neither is selected). I kno ...

Optimal method for utilizing @font-face syntax

Recently, I've been utilizing this specific model @font-face { font-weight: WEIGHT; font-style: STYLE; font-family: 'NAME'; src: url('font.eot'); src: url('https://dl.dropboxusercontent.com/s/dey3lzjdpgszxzt/myriad-webfont.eo ...

Is there a way to prevent the window.status from appearing?

I currently have the following code snippet: <a class="button accessLink" id="loginLink" href="#" data-action="Login" data-dialog="access" data-disabled="false" data-entity="n/a" ...

Ways to execute a JavaScript function upon a button click instead of during the page load completion

I searched on Google but couldn't find the answer, so I'm asking here for help. In the attached screenshot located at the end, when the user clicks on the download button, some backend actions are performed such as file transfer. Once the proces ...

Initially, the 'display none' CSS command may not take effect the first time it is used

I am currently working on a slideshow application using jquery.transit. My goal is to hide a photo after its display animation by setting the properties of display, transform, and translate to 'none' value. Although the slideshow application work ...

What could be the reason behind Google and Bing's mobile-friendly tests inaccurately flagging my site as non-mobile friendly?

Our website for resources is responsive and has been thoroughly tested on various real smartphones, including iPhone, Android, and Windows devices. It looks great on every phone we've tested it on. You can visit the resources website here: The site ...