How come the section of a web page covers the header when the header's position is set to fixed?

My attempt at fixing the position property of the header as fixed has not been successful. When I scroll down the page in mobile view, the section part of the webpage overlaps the header part. The home section in this code functions properly, but the About section is not displaying correctly. I have already included CSS and JS files to make the webpage responsive, although it is not explicitly mentioned here.

    <body>
    <header>
        <div class="row">
            <div class="col-3 col-md-6" id="logo">
                <a class="logo" href="#">Xyz<span>Abc</span></a>
            </div>
            <div class="col-9 col-md-6">
                 <nav class="navbar navbar-expand-lg navbar-light">
                     <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
                         <div class="navbar-nav">
                            <a class="nav-item nav-link" href="#">Home <span class="sr-only"> 
                            (current)</span></a>
                           
                         </div>
                     </div>
                 </nav>
            </div>
        </div>
    </header>
    <section class="home">
            <div class="row">
                <div class="col-12">
                    <h2>Hello,I'm Xyz Abc</h2><br>
                    <p>I am Developer</p><br>
                    <p>Let's start <span>Scrolling</span>  and know more <span>About Me.</span> </p>
                </div>
            </div>
    </section>
    <section class="about">
        <div class="container-fluid">
            <h3>About Me</h3>
            <div class="row">
                <div class="col-sm-5 col-12 bg-danger">
                     <img src="profile.jpg">
                </div>
                <div class="col-sm-7 col-12 bg-info">
                     <h5>I am Xyz Abc and I'm a <span>Developer</span></h5>
                </div>
            </div>
        </div>
    </section>
    </body>
    </html>

Css Page:

        *{
        margin:0;
        padding:0;
        text-decoration:none;
        width:100%;
        }
        header{
        font-family:sans-serif;
        position:fixed;
        background-color:green;
        height:70px;
        width:100%;
        }
      .home{
      display:flex;
      background-image: url("a4.png");
      width:100%;
      height:100vh;
      padding-top:60px;
      }
      
    .about{
    padding-top:150px;
    width:100%;
    }
   .about .row {
    width:100%;
    }
    

Answer №1

To ensure your website header remains fixed at the top of the page, apply the boostrap class fixed-top

<header class="fixed-top ">
.
.
.
</header>

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

"Clicking on the dropdown menu fails to trigger it to open

The dropdown menu within the navbar fails to open when clicked. Here's a snippet of the HTML structure: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-wid ...

Navigation links transforming hues unpredictably

After creating a navigation list for a client using the [Oswald]() font-face, an issue arose when the user scrolled over the links. Instead of a navigation arrow popping up as intended, the links turned orange upon hovering. Despite removing all javascript ...

Ways to ensure that v-model does not become "true" or "false" in an input checkbox using Vue

I am currently working on a filter popup that includes a list of checkboxes. By default, some items should be selected and others not selected. I have connected these checkboxes to an object array using v-model. My issue is that when I deselect and select ...

Implement a scrolling feature to the tooltip when using "data-toggle"

I'm struggling with a piece of code that showcases a tooltip when the user hovers over the question circle icon. The tooltip's content can't exceed 1000 characters, but I need to figure out how to make the overflow scroll by adjusting the to ...

The "in" class for Bootstrap collapse is not functioning as expected

I am currently experimenting with Bootstrap's collapse class to create a toggle effect for an element when a checkbox is clicked. The initial state of the page should have the checkbox unchecked and the element displayed. Upon clicking the checkbox, t ...

How to Display Full Lightbox Image on both Tall and Short Height Browsers

Hey there! I'm showcasing my portfolio using lightbox, but I've run into a little issue. When the browser height is full, everything looks great - you can see the entire image, along with the paragraph and buttons. https://i.stack.imgur.com/UCJG ...

What is the best way to transform this unfamiliar CSS element into JavaScript code?

I'm facing an issue where I want to animate a CSS image based on time constraints, but since it's in CSS, I'm unable to achieve the desired effect. The animation in question is not the sun itself, but rather a yellowish half-circle animation ...

Customize the text color across all sections of the application in ExtJS 6

I am looking to update the text color across my entire application. Currently, it's gray and I would like to change it to black. The platform I am working with is classic. I came across this code snippet in CSS: .x-body { margin: 0; -webkit-f ...

Is there a way for me to have an image smoothly ascend as the caption rises?

I have put together the following html snippet: http://jsfiddle.net/4gDMK/ Everything is working smoothly, but I am struggling to figure out how to simultaneously move both the captions and the image upwards so that the entire image is no longer visible. ...

Background image for numerical input field

I am currently working on customizing a form that includes a Number field, image button, and an image. My goal is to change the background of the number field to be a similar image. Below is the HTML code I have been using: <form name="form1" id="form1 ...

Choose a single dynamic image from a collection of multiple images

In the process of developing a Shopping cart website, I encountered an issue regarding allowing users to upload multiple images of a single product. Using jQuery, I successfully cloned the file input section to enable uploading additional images of the sam ...

A div element that automatically adjusts its width to fill the available horizontal space, and is then re

div</code> elements next to each other horizontally. The right div should adjust its size based on its content up to a set maximum width, while the left one should occupy the remaining space. I have successfully achieved this layout by floating the ...

Is there a way to position headline text behind another headline? Take a look at the image provided for reference

I need help creating headline text with a background image similar to the example below. I tried using relative positioning on the first heading, but I can't seem to get it to work correctly. If anyone can provide me with the code to achieve this ef ...

Applying a class change in Vue.js upon mounting

How can I make a button element with a .hover property trigger the hover animation as soon as the page loads? I want to apply a class to the button when the page is mounted and then remove it later. What is the best approach for this? I considered using a ...

saving information to a MySQL database after receiving data through HTML forms

I'm currently facing an issue with referencing the database to store new user information on my website. Below is an example of the HTML and PHP form we are utilizing: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/htm ...

Search bar that automatically adjusts based on the size of the containing div

https://i.stack.imgur.com/wtn8K.gif I'm interested in learning how to achieve a layout similar to this. Here's an example of what I've created: <div class="header-con"> <div class="search-bar-con"> <input type ...

What is preventing me from using jQuery to dynamically insert HTML onto the page?

Below is the HTML code for a Bootstrap Modal dialog box: <div class="modal fade" id="rebateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> ...

Ensure that the body background image remains stretched and perfectly centered regardless of the screen resolution

I am having an issue with vertical centering on a website I created. Everything looks fine on my monitor, but at higher resolutions, the tables don't align in the center and the image shrinks. How can I ensure that everything stays aligned properly? ...

Using Bootstrap to align a button and an input field on the same line within a form-control

Is there a way to ensure that the button remains on the same line as the input text in the previous forms-control? <div class="row"> <div class="form-group col-xs-6 col-md-5 "> <label for="">Name</label> <input class=" ...

Gradually appear with jQuery while maintaining current position

Exploring Display Options In my current setup, I have text that initially has a display:none property, and jQuery is applied to fadeIn() the content. The challenge lies in the fact that since the text is centered, as each word appears, the positioning on ...