Can you have two navigation bars and a picture all in one Bootstrap layout?

I have a requirement to use a single image on two different Bootstrap navbars. However, the issue is that the image appears split between the two navbars.https://i.stack.imgur.com/jUnIL.png

My goal is to display the full image without it being divided between the navbars. Here's an excerpt from my code:

<nav class = "navbar navbar-fixed-top"> 
<nav calss = "navbar navbar-default">
  <div class="container-fluid">
    <ul class = "nav navbar-nav navbar-top navbar-right">
      <li><a class = "links" data-page = "us_hu" href = "#index_hu">Rólunk</a></li>
      <li><a class = "links" data-page = "services_hu" href = "#services_hu">Szolgáltatások</a></li>
      <li><a class = "links" data-page = "actual_offers_hu" href = "#actual_offers">Aktuális ajánlatok</a></li>
      <li><a href="./">EN</a></li>
    </ul>
  </div> 
</nav>

     <body id = "page-top" data-spy = "scroll" data-target = ".navbar-fixed-top" data-offset="40">
<nav class = "navbar navbar-fixed-top" style = "top:35px;">
<nav class = "navbar navbar-default">
  <div class = "container-fluid">
    <div class = "navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#matomNavbar">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            <a class="navbar-brand" href="#matomPage">M.aTom</a>
    </div>  
      <div class="collapse navbar-collapse" id="matomNavbar">
    <ul class="nav navbar-nav navbar-right">
      <li class="active"><a href="#our-task">Alapelvünk</a></li>
      <li><a href="#gallery">Galéria</a></li>
      <li><a href="#about">Rólunk</a></li>
      <li><a href="#team">Csapat</a></li>
      <li><a href="#contact">Kapcsolat</a></li>
    </ul>
   </div>
  </div>
 </nav>
</nav>

CSS:

.navbar {
    font-family: 'Overpass', sans-serif;
    margin-bottom: 0;
    /*background-color: #4c4c4c; */
    background-image: url('../images/ten.png');
    border: 0;
    font-size: 12px !important;
    line-height: 1.42857143 !important;
    letter-spacing: 1px;
    border-radius: 0px;
    min-height: 0px;
}

Answer №1

Give this a try---

<div class="wrapper" style="background-image:url('insert your image URL here')">
<div class="first_nav">
<div>
<div class="scnd_nav">
</div>
<div>
<script>
$("#first_nav").load("file path to first_nav file");
</script>
<script>
$("#scnd_nav").load("file path to scnd_nav");

</script>

Now set the background image for the wrapper div.

UPDATE

In the following code snippet, you can observe that the background image is not showing properly. Make sure to assign a proper height css property to the wrapper div.

<!doctype html>
<html>
<head>
 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
          <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  </head>
<div style='background-image: url("https://images-na.ssl-images-amazon.com/images/G/01/img15/pet-products/small-tiles/23695_pets_vertical_store_dogs_small_tile_8._CB312176604_.jpg"); height:70px;'>
<nav class = "navbar navbar-fixed-top"> 
    <ul class = "nav navbar-nav navbar-top navbar-right">
      <li><a class = "links" data-page = "us_hu" href = "#index_hu">About Us</a></li>
      <li><a class = "links" data-page = "services_hu" href = "#services_hu">Services</a></li>
      <li><a class = "links" data-page = "actual_offers_hu" href = "#actual_offers">Current Offers</a></li>
      <li><a href="./">EN</a></li>
    </ul>

  </nav>
  <nav class = "navbar navbar-fixed-top" style = "top:35px;">

  
    <div class = "navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#matomNavbar">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            <a class="navbar-brand" href="#matomPage">M.aTom</a>
    </div>  
      <div class="collapse navbar-collapse" id="matomNavbar">
    <ul class="nav navbar-nav navbar-right">
      <li class="active"><a href="#our-task">Our Mission</a></li>
      <li><a href="#gallery">Gallery</a></li>
      <li><a href="#about">About Us</a></li>
      <li><a href="#team">Team</a></li>
      <li><a href="#contact">Contact</a></li>
    </ul>
   </div>
 
</nav>

  </div>
  </html>

PLEASE NOTE

Ensure to add an appropriate height property based on screen size using the @media property. For the above code snippet, view it in full screen mode to see it in action.

If you are wondering why this issue is occurring--

Using class="navbar-fixed-top" causes the navbar to detach from the layout. Therefore, specific css adjustments need to be made on the rendering page. Hope this explanation helps!

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

passing a javascript variable to html

I am facing an issue with two files, filter.html and filter.js. The file filter.html contains a div with the id "test", while the file filter.js has a variable named "finishedHTML." My objective is to inject the content of "finishedHTML" into the test div ...

Tips for seamlessly integrating full-size images into the slider?

I'm a beginner when it comes to CSS and I am having trouble fitting two images inside my first slider. My goal is to display the full images within the slider, but the width of the images exceeds that of the slider. Below is the CSS code for the slid ...

Problems with the bottom section

Is there a way to make the middle section extend downwards when the window is resized, keeping the footer at the bottom without overlapping with the content? If anyone has suggestions on how to achieve this, please share! I'm hoping there's a b ...

Ensure that the child element completely fills the parent element while maintaining a padding around the edges

How can I create a child div that fills 100% of the parent's width and height, including padding? I've tried using box-sizing = border-box, but it isn't working. I also attempted adding the box-sizing property to all elements with *, but tha ...

Adjust the font size within the grid layout

I'm utilizing the grid system to display 7 small images with a number next to each one, just like in this example. In my initial attempt, I didn't use the grid system, which made the process quite complex and time-consuming, taking me around 60 t ...

ASP repeater exceeding container boundaries

Having trouble with my asp repeater that reads from a database and generates repeatable divs. The issue arises when the h4 spills over the div, particularly when using <%Eval. Any suggestions on how to fix this? Manual input divs don’t seem affected o ...

Excess space creating horizontal and vertical scrolling issues on an HTML webpage

Currently, I am experimenting with CSS effects. In my code, I have included div elements to display balls on the document body, each with random sizes and colors. However, an unexpected issue has arisen - excess scroll space is being generated due to the c ...

The clash between the position:fixed and overflow:visible styles in CSS

I'm working on a webpage layout that includes an image positioned on the right side of the page. I want to create horizontal scroll bars when the browser window is resized, so I added the overflow: visible property. Additionally, I want the image to b ...

Avoid inserting line breaks when utilizing ngFor

I am using ngFor to iterate through a list of images like this: <div class="image-holder" *ngFor="let image of datasource"> <img src="{{image.url}}" height="150" /> </div> Below is the corresponding CSS code: .image-holder { di ...

Elevate Your Flipclock.js

I am currently working on a website that utilizes flipclock.js, but I am facing some challenges in enlarging it to occupy more space on the page. Is there anyone who knows how to upscale or increase its size? ...

Automatic playback of the next video in a video slider

Looking to upgrade my video slider functionality - switching between videos, playing automatically when one finishes. Struggling to find a solution that combines manual control with automatic playback. My attempt: function videoUrl(hmmmmmm){ ...

How do you prevent items from shrinking in a flex container when they have more content?

I am facing an issue with a flex container where the items are set in a row. Once it reaches the end of the viewport width, I want it to overflow-x: scroll. However, instead of enabling scrolling, all items shrink when more items are added to fit the scree ...

Why does the video cover extend past its lower boundary in HTML?

I'm facing an issue where a purple cover over the <video> element extends slightly beyond the video's bottom border. Here's the code I'm using: .media-cover { display: inline-block; position: relative; } .media-cover:after ...

Apply a CSS class to the selected radio button when retrieving row data from the table

How can I dynamically add a CSS class to a snippet of code when a radio button is selected? Here's the jQuery Snippet: $(document).ready(function (){ $("input:radio").click(function () { if ($(this).is(":checked")) { var empid ...

How can Material UI React handle long strings in menu text wrapping for both mobile and desktop devices?

Is there a way to ensure that long strings in an MUI Select component do not exceed the width and get cut off on mobile devices? How can I add a text-wrap or similar feature? Desktop: Mobile: <FormControl sx={{ m: 1, minWidth: '100%', marg ...

Step-by-Step Guide: Unveiling a Particular Modal Post-Submission of Form with

My website has a form inside a modal, and when the form is submitted, I don't want the modal to close. However, I have encountered an issue because my SQL UPDATE statement redirects to the same page after updating the database. This disrupts the funct ...

Krajee Bootstrap File Input, receiving AJAX success notification

I am currently utilizing the Krajee Bootstrap File Input plugin to facilitate an upload through an AJAX call. For more information on the AJAX section of the Krajee plugin, please visit: Krajee plugin AJAX The JavaScript and PHP (CodeIgniter) code snippe ...

I am attempting to achieve a smooth transition effect by fading in and out the CSS background color using JQuery and AJAX

Can anyone help me with my issue related to using Ajax to fadeIn a background color in beforeSend and fadeOut in success? I seem to have made some mistakes but can't figure out what went wrong. var data={ ...

Picture not displaying properly in alternative browsers

While working on a simple website using html and css, I encountered an issue where my logo was not displaying for users on different browsers. Here is the image description Below is the HTML code: <section id="header"> <div class=& ...