Booting up with Bootstrap 4 for a sticky position experience

I am currently utilizing bootstrap to design my website. I have a sticky nav-bar and a button, both of which should ideally stack one on top of the other in the following manner:

  • ------------------------------Nav-bar------------------------------
  • ------------------------------Button------------------------------

However, the issue I am facing is that they end up overlapping each other in a strange way.

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />


<nav class="navbar navbar-dark sticky-top bg-dark navbar-expand-lg navbar-light bg-light d-flex justify-content-between">
  <a class="navbar-brand" href="#">
    <img id="logo" src="../Images/ZipUpSVG.svg" alt="Creatives-Logo">
  </a>
  <ul class="navbar-nav">
    <li class="nav-item"><a class="nav-link" href="https://www.fiverr.com/cre4tivesstudi0?up_rollout=true">Hire Me</a></li>
    <li class="nav-item"><a class="nav-link" href="../ShopPage.html">Shop</a></li>
    <li class="nav-item"><a class="nav-link" href="../SocialMediaPage.html">Social Media</a></li>
    <li class="nav-item"><button class="btn snipcart-customer-signin nav-link"><i class="fas fa-user"></i> Sign in</button></li>
    <li class="nav-item"><button class="btn snipcart-checkout nav-link"><i class="fas fa-shopping-cart"></i>
                  <span class="snipcart-total-price">$0.00</span>
              </button></li>
  </ul>
  <div class="burger">
    <div class="burger-container">
      <div class="burger-text">
        <h2>MENU</h2>
      </div>
    </div>
  </div>
</nav>
<div class="row sticky-top">
  <div class="col-12  text-center">
    <button class="btn btn-outline-danger px-5 py-4">Download Now</button>
  </div>
</div>

#logo {
    width: 138px;
}
.bg-dark{
    background-color: #CC2B57 !important;
}
.burger {
    padding-top: 0.5rem;
    padding-right: 0.5rem;
    padding-bottom: 0.5rem;
    padding-left: 0.5rem;
}
.burger-container {
    padding-top: 0.5rem;
    padding-right: 0.5rem;
    padding-bottom: 0.2rem;
    padding-left: 0.5rem;
    background-color: hsla(34,95%,57%,0.78);
}
.burger-text  {
    color: #FFFFFF;
    font-size: 2rem;
    background-color: #FED767;
    padding-right: 0.5rem;
    padding-left: 0.5px;
    text-align: center;
}
.burger-text  {
    color: #FFFFFF;
    font-size: 2rem;
    background-color: #FED767;
    padding-right: 0.5rem;
    padding-left: 0.5px;
    text-align: center;
}
.contact {
  flex-basis: 30rem; 
}
.nav-links {
  font-size: 3rem;
  flex-basis: 30rem;
  }
  .nav-bar {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: space-between;
    align-items: center;
    opacity: 1;
    clip-path: circle(50px at 100% -10%);
    -webkit-clip-path: circle(50px at 100% -10%);
    display: flex;
    z-index: 1000;
    background-color: #2D2871;
    position: absolute;
    font-family: 'Corben', cursive;
    background-blend-mode: overlay;
    padding-left: 15rem;
    padding-right: 15rem;
}

Answer №1

The inclusion of the "sticky-top" class from the Bootstrap content delivery network applies a top:0 style to your elements initially. Since the elements had existing classes, I utilized the class selector to supersede that class property.

.row.sticky-top, .navbar.sticky-top{
  top: unset;
}

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

Troubleshooting the mysterious provider problem in Ui-router

I encountered this error message: "Module 'ui-router' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument." https://i.sstatic.net/o ...

What is the best way to rearrange the order of navbar items when working with two nav bars and a single toggle in bootstrap 4?

I am looking to implement a design with two navigation bars that share a single toggle. The first navbar should include the logo, email icon, and a search box, while the second navbar is reserved for additional links. On smaller screens, when the toggle ...

Using Jquery to Highlight the Background Image in a Circle

I currently have 3 images named back_about_1.jpg, back_about_2.jpg, and back_about_3.jpg. There is a div with the ID "about" - <div id="about"></div> The default background image of the div is set to back_about_1.jpg using CSS - background: u ...

JavaScript can retrieve the default page name that is hidden within the browser's URL

When a URL is entered without a specific file name at the end, such as "www.google.com," the server typically serves a default file like "index.html" or "default.aspx." In this scenario, if the browser displays "www.google.com," I am looking to extract the ...

Is there a way to decrease the speed of a range slider?

Recently, I created a range slider using HTML, CSS, and JS to complement my Lua Nui. It's been working smoothly for the most part, but I've noticed an issue when sliding too quickly on the slider. As I slide it to the left, certain values fluctua ...

What is the best way to transform the incoming data using JavaScript?

The data I have from Algolia in my project includes a seconds data presented as an array. This is the method I use to extract the seconds data from Algolia: @if(isset($content['length'])) <div class="flex items-center space-x-6"> ...

The ngOnChanges lifecycle hook is not being triggered

I've been working on a small project that involves two components: menu and bill. I'm trying to figure out how to make it so that when the quantity of any menu item is changed, the onChanges function in the bill component is called. I also need t ...

Looping through images using JQuery

I'm struggling with an image animation and can't quite figure out how to make it work. <div id="img_loop"> <img src="img/img1.jpg" alt="image1" /> <img src="img/img2.jpg" alt="image2" class="hidden" /> <img src="im ...

Utilize media queries to deactivate a CSS rule at a specific screen width, in conjunction with Bootstrap grids

I'm working on a webpage with a sidebar that needs to adjust its size based on the screen width: When the screen is below a certain size, I want the sidebar to be short and wide (width of the screen). When the screen is above a certain size, I n ...

How can I convert an HTML/CSS form into a PDF without altering its CSS design?

On my form, there are specific fields that users need to fill out. I'm looking for a way to automatically generate a PDF when these fields are submitted. Can anyone provide assistance with this? Currently, I've been redirecting the form data to ...

What could be the reason for my onChange event not functioning properly?

The issue I'm experiencing involves my onchange event not properly copying the text from the current span to the hidden field. Any ideas on why this might be happening? Check out my code at this link. ...

Utilizing the onCLICK event handler with numerous parameters

I'm in need of assistance with creating a function that involves multiple variables, preferably at least two... The table I am working with was generated using PHP and MySQL, all IDs were dynamically created which is why I am looking for a way to cap ...

What causes Next.JS to automatically strip out CSS during the production build process?

Encountering unpredictability in CSS loading while deploying my Next.JS site. Everything appears fine locally, but once deployed, the CSS rules seem to vanish entirely. The element has the attached class, yet the corresponding styling rules are nowhere to ...

Having trouble retrieving the value from the input DOM element

Below is the html and JS code that I am working with: function controller() { document.write(document.getElementById("name").value) ; document.write(document.getElementById("id").value) ; } <input type="text" id= ...

Is there a way for me to access the response from the PHP file I'm calling with Ajax?

I am just starting to explore ajax and jquery, and I recently found a code online that I'm tweaking for my own use. However, I am struggling with how to handle responses from PHP in this context. The current setup involves ajax POSTing to a php page ...

Using React Native to create a concise text component that fits perfectly within a flexbox with a

Within a row, there are two views with flex: 1 containing text. <View style={{ flexDirection: "row", padding: 5 }}> <View style={{ flex: 1 }}> <Text>Just a reallyyyyyyyy longgggg text</Text> </View> ...

Achieve a main-menu container with a full width dropdown using Bootstrap 4

I want the dropdown to start from the initial position for all menus and maintain a width of 600px. Even if I attempt to open the dropdown for "Main Menu 2" or "Main Menu 3" or "Main Menu 4", the dropdown should always start from the position of "Main Men ...

Emails in Dark Mode: Enhancing the User Experience

I am currently working on a project involving emails and I need to implement a dark mode for the email body. The email body is comprised of HTML with specific color styles defined. My objective is to change the text and background colors to create a dark m ...

Looking for a way to incorporate dynamic rows within Bootstrap 4?

I am struggling to figure out how to structure my bootstrap rows and columns to line up as shown in the image. I have attempted nesting columns within rows and vice versa but haven't had any success. The yellow and green sections in the picture are d ...

Placing an element with position:absolute inside another element with position:fixed

I am working with a fixed position div that is always centered in the browser viewport. Within this div, there is another div set to absolute positioning. It seems like this inner div is actually being positioned relative to the HTML document since there ...