The background image of the navigation bar does not adjust properly when resized

Is there a way to make the background image of my navigation bar expand along with the menu when resizing the screen to mobile size and clicking on the hamburger menu?

It seems that if my navbar background is a color by default, it expands automatically.

.navbar {
  background-image: url('/images/HEADER.png');
  width: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  top: -10px!important;
  height: 110px;
}

.navbar-toggler {
  outline: none!important;
}

.nav-link {
  color: black;
  font-family: myriad-pro, sans-serif;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  line-height: 10px;
  font-size: 0.8rem;
}

.nav-link:hover {
  color: white;
}
<nav class="navbar navbar-expand-lg fixed-top">
  <a class="navbar-brand ml-lg-5 pl-5" href="#"><img height=7 0px; class="img-responsive" src="images/logo.png" alt=""></a>
  <button class="mb-2 navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <div id = "hamburger">
        <div class = "one"></div>
         <div class = "one"></div>
         <div class = "one"></div>
    </div>
                </button>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav ml-auto mr-5 pr-5">
      <li class="nav-item active">
        <a class="nav-link" href="#pagrindinis">Pagrindinis<span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#paslaugos">Paslaugos</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#portfolio">Atlikti Darbai</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#apie">Apie Mus</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#kontaktai">Kontaktai</a>
      </li>

    </ul>
  </div>

</nav>

Answer №1

Allow the navbar to expand freely from the beginning

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

To grab a specific CSS attribute from a stylesheet using JavaScript

I am looking for a way to extract the value from a CSS file using a JavaScript function. Take a look at my code snippet below: HTML file -> <link rel="stylesheet" type="text/css" href="test_css.css" /> <script type="text/javascript ...

Achieving Vertical Stacking and Responsive Scaling for Row and Column Containers on Mobile View Using HTML, CSS, and Bootstrap 4

Utilizing the Bootstrap grid system to organize text boxes in a 2 by 2 layout on a webpage. The desktop view displays the content in rows and columns effectively, but it would be beneficial to have an easy way to adjust the width. However, the problem ari ...

Why is Google Chrome cutting off parts of my website?

Has anyone encountered the strange rendering issue in Google Chrome? Check out this bug here http://community.mediabrowser.tv/uploads/site_1/126/annoying_rendering_bug.jpg I sometimes experience it when I visit What is causing this issue? Is there a way ...

Modifying email alters the appearance of the input element

Utilizing labels as placeholder text behind input boxes with a transparent background, changing to white on :focus and when input value is > 0, I created a contact form. However, integrating PHP into the form recently caused styling issues. Although I m ...

Using jQuery's .load() method to load a PHP file can result in an exponential increase in XHR finished loading time with each subsequent load

There seems to be an issue with my code using .load() to load a PHP page into a div whenever the navbar or link is clicked. After multiple clicks, I noticed that the "XHR finished loading" increases exponentially and it appears that the same PHP file is be ...

execute a retrieval query on an html pop-up

I have recently created an HTML web resource that I am displaying when a ribbon button is clicked. Within this popup, there is a dropdown list that I intend to fill with records obtained through a fetchXml query. The issue I'm encountering is that de ...

The signature only appears once the modal bootstrap has been resized

After a user enters data in my application, they are required to sign using the signature-pad plugin found here: https://github.com/szimek/signature_pad. The signature is then placed in a modal created using bootstrap4. The problem arises when I try to op ...

Learn the process of redirecting to a new page using React JS

Currently facing an issue with the Signup button functionality within the Signin dropdown. Instead of opening a new page, it is displaying below the footer. Seeking assistance on how to redirect to a new page when clicking on the signup button. App.js fi ...

Performing a jQuery post request using AJAX and setting the content type

Greetings, here is the code snippet: <script type="text/javascript"> 14 $(document).ready(function() { 15 $('#find').click(function(){ 16 17 var amount = $(' ...

stop the menu component from triggering a re-render

I am facing an issue where the menu opens and closes briefly when I refresh the page. I want to find a way to prevent this re-rendering process. Every time I refresh, my console.log shows: false 'open' navigation.jsx:23 item navigation.jsx: ...

Is there a way to arrange three of these cards side by side using CSS to alter their layout?

Hey everyone, I currently have a page that looks like this: Check out the current page I'm looking to change it so that instead of one image per row, there are three images per row (and reduce their size to fit three in a row). Here is my current c ...

Rotate a div using CSS by 10 degrees while spanning the full width

I stumbled upon the website recently, particularly noticing the Social News section on the side. I am curious about how to create rotated divs (around 10 degrees) that span the full width of a webpage. Is it possible to make this responsive so that it wor ...

How can I design an SVG page similar to Coin360 and Market Maps?

I need to design a homepage similar to coin360.com, where I can display market maps and cryptocurrency rates. This page will be created using SVG elements for the answers section. Is there a pre-made template available for this design, or can someone gui ...

The CSS star rating system is malfunctioning

I'm struggling to implement a rating star system in my project. I have experimented with various code snippets, but none seem to be functioning properly. Take a look at the outcome: https://i.sstatic.net/g3DvH.png ...

How can the text color of an ASP Label be modified when the DropdownList value is updated?

Objective: Modify the text color of an ASP Label based on the selection made in an ASP Dropdown ListItem. If the ListItem's value is false, then set the Label's text color to red; otherwise, keep it black. Challenge: The color only changes when ...

Is it possible to conceal specific sections of a timeline depending on the current slide in view?

For my product tour, I've structured a timeline with 4 main sections, each containing 4-5 subsections. Here's how it looks: <ul class="slideshow-timeline"> <li class="active-target-main main-section"><a href="#target">Targe ...

Using HTML and PHP, I am able to automatically redirect users to another

In the mix of files A.html, B.php, and File C.php there was a creation of a button that redirects from A to B, carrying over values provided by the user in A: <form action="B" method=post> <tr><td colspan="2" align="center"><input typ ...

The use of e.preventDefault in Ajax/jQuery is stopping the page from refreshing and preventing the form

Currently, I am experimenting with using ajax/jQuery/php/html to submit my form without reloading the page. If I include e.preventDefault(), the page remains static and the form does not get submitted. When I remove e.preventDefault(), the form gets submi ...

jquery selector to target an element nested inside an anchor tag

Is there a way to use a Jquery selector to extract the text content within the 'name' attribute? <a href="page1.php" id='title' name="<?php echo $res['id'];?>" title="<?php echo $res['title'];?>" < ...

trouble displaying Google AdSense ads

I'm having trouble getting the ad to display on my website despite trying many different solutions. Any advice you can offer would be greatly appreciated. Thanks in advance! <!doctype html> <html lang="en"> <head> < ...