Hamburger Menu Design with Bootstrapping

I am working on creating a responsive navbar that displays as a traditional desktop menu and switches to a hamburger menu for mobile devices. However, I have encountered an issue with the hamburger menu overlapping part of the background image. I want the background image to always remain behind the hamburger menu. Below is the code I am using:

    <nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
      <div class="col-interno">  <--col interno is for color-->
      <!-- Logo -->
      <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mainNavBar">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
          </button>
          <a href="#" style="vertical-align:middle" class="navbar-left"><img src="css/logo.png" style="width:78px"></a>
          <a href="#" class="navbar-brand">Generic Brand</a>
      </div>

      <!-- Menu Items -->
      <div class="collapse navbar-collapse" id="mainNavBar">
          <ul class="nav navbar-nav navbar-right">
              <li class="active"><a href="index.html">Home</a></li>
              <li><a href="chi-siamo.html">Who</a></li>
              <li><a href="servizi.html">Services</a></li>
              <li><a href="contatti.html">Contact Us</a></li>
          </ul>
      </div>

    </div>
     <div id="testata-back">
     </div>
      </nav>
       <div class="testata-500-1 testata-servizi"> 
        <div class="testata-500-logo-transparent">
<!-- These classes represent two images positioned below the hamburger menu ideally -->

    </div>
    </div>
    </div>

[1

CSS

 testata-500-1{margin:0 auto;height:500px;box-shadow:inset 0 -2px 3px 1px rgba(0,0,0,.4)}

Custom CSS

@media only screen and (min-width:1024px){.testata,.contents,#footer-bar,#credits-bar{width:960px}#hamburger{display:none}}@media only screen and (min-width:768px) and (max-width:1023px){.testata,.contents,#footer-bar,#credits-bar{width:740px}#logo{position:absolute;left:26px;top:65px;z-index:2000;width:150px;height:124px}.testata-500-1{height:250px;background-size:130%}.testata-500-logo-transparent{height:250px;background-size:155%}#testata-menu{top:10px}#hamburger{display:none}}

Answer №1

To adjust the placement of your background image, simply use the background-position: X Y property in your CSS code. Set the value of X to 0 and then adjust the height on the y axis as needed. If required, utilize media queries for different screen sizes.

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

The container is unable to contain the overflowing Slick carousel

The carousel in Slick is overflowing the container. Expected Result - First Image / Current State, Second Image Parent Container HTML (layout) <main> <div class="layout__main-container p-4"> <app-discover-animals clas ...

The base tag does not impact the <META HTTP-EQUIV="Refresh" element in any way

Similar Question: How to check for disabled JavaScript? I am attempting to identify whether or not JavaScript is disabled in the user's browser. To achieve this, I have inserted an iframe into the document and set it to refresh every 10 seconds. ...

Differences in heights of the Bootstrap carousel in a responsive mobile view

My website features numerous carousel sliders that function perfectly on PC, but appear unappealing on mobile devices. The issue at hand is as follows: Imagine each carousel slide contains a maximum of 4 images, all within a col-md-3.col-12 div. <div ...

Card carousel rotation

Apologies for the vague title, I'm unsure how to properly label my issue. I have a section set up with cards, but I'm aiming to create something resembling a menu that functions like a carousel. Essentially, I want to include right and left arro ...

jQuery Mobile panel buttons are functioning properly within a maximum width of 300 pixels

I have constructed a panel that adjusts its size based on the device's screen using responsive design techniques. The code for this panel is as follows: <div data-role="panel" data-position="right" data-display="overlay" data-theme="a" id="add-for ...

What is the best way to remove this .click function?

My goal is to create a switch function where clicking the "on" button changes its CSS, and if the user then clicks on the "off" button, the CSS returns to normal. I also need the switch to default to the "on" position, but my attempts so far have been unsu ...

Aligning a set of list items horizontally within an unordered list is a great way to maintain a clean

I'm struggling with centering the alignment of li elements within a ul. Below is the excerpt from my code: ul.nav { width: 1000px; margin: 0 auto; list-style-type: none; } .nav li { float: left; width: 300px; } #government { clear: left ...

The clash between React Inline styles and Client CSS can lead to conflicts in styling

Our application needs to be loaded into the client's page, which is built using React. We are implementing React Inline Styles by defining styles as objects. However, we have encountered an issue where any CSS specified by the client using tag attribu ...

Incorporate a vertical scrollbar in the tbody while keeping the thead fixed for smooth vertical scrolling

I'm seeking a solution to implement horizontal and vertical scroll for my table. Currently, the horizontal scroll is working fine, but when trying to add vertical scroll, the table header also moves along with it. Is there a way to keep the table hea ...

Counting the number of PHP inputs in a field

Hello, I am using a PHP script from Steve Dawson's website. To display the output on my HTML page, I am utilizing this AJAX script: <script> $.ajax({ type:'GET', url:'http://www.solariserat.se/count.php', data: ...

The Jqueryui image link is not displaying the image despite no error being reported

Can anyone help me figure out what I'm missing? I'm currently working with ASP.NET MVC 5 and have downloaded the JqueryUI combined via Nuget package. Despite no error references for css/js files, the close button is still not showing in the ima ...

Create an HTML table with a line separating two table cells

I need help with creating a table row and td's dynamically using basic HTML and CSS. I would like to draw lines between the td's similar to the example image shown below. Can someone please assist me in achieving this? https://i.sstatic.net/GPd ...

Guide to automatically converting Google fonts to base64 for inline use

I am currently in the process of creating my own personal blog using next.js. While everything is going smoothly with the use of Google Fonts for font styling, I have encountered an issue with initial content shift upon loading. This occurs when a new fon ...

Is your event listener failing to activate?

I have been working on a project where I gather array elements from user input and try to display them in an HTML table. Unfortunately, the event listener seems to not be triggering, and I can't figure out why. Here is the relevant HTML code: ...

Mysterious area located within a flexbox set to display items in a column arrangement

There is a mysterious gap within a flexbox that has a column direction. In the header-left div, I have set up a flexbox with a column direction. It consists of three nested divs: left_text_heading, hero-img, and hero-text. Strangely, there is an unknown s ...

What is the best way to combine values passed from PHP to AJAX?

I need to combine the contents of showFname, showMname, and showLname and display the result in showName. However, I am facing an issue where the combined names are not appearing in showName. HTML <input type="text" id="showFname" name="showFname" /& ...

Switch from using a select tag to a check box to easily switch between a dark and light theme

I have implemented a feature on my website that allows users to toggle between dark and light themes using the select tag with jQuery. Here is the code snippet that I am currently using: $(function() { // Code for changing stylesheets based on select ...

How can I style the inner div by adding a class to the first div?

In my project, I have a list of elements that are generated dynamically, all styled the same way but with different content. The first element has a specific styling, and if it doesn't render, I want the second element to inherit that styling. < ...

Angular 2 ngIf displaying briefly before disappearing

Encountering a strange issue with an Angular 2 ngIf statement where it appears on the page for a brief moment and then disappears. The content is visible, but it doesn't remain on the page. I suspect it might be related to some asynchronous behavior. ...

Could you please let me know how I can align underneath?

Image description can be found here Your assistance is greatly appreciated, as I am currently inexperienced with React and JavaScript. I am self-studying, so please excuse any basic questions. I have encountered a challenge with this issue. In the image ...