Chrome and Safari disregarding navbar height dimensions

Recently, I encountered an unexpected issue in a local project that I've been working on. Two weeks ago, everything appeared correctly, but now Chrome and Safari are ignoring the height of the navbar. Surprisingly, Firefox is displaying it correctly, as well as on Codepen. This website is built using Wordpress + Bootstrap 4.

Check out the difference between Firefox and Chrome here.

Here's the HTML code snippet:

    <nav id="top-navbar" class="navbar sticky-top navbar-expand-lg navbar-dark animate">
    <div class="container">
      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#bs4navbar" aria-controls="bs4navbar" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div id="bs4navbar" class="collapse navbar-collapse mx-auto">
        <ul id="menu-left" class="navbar-nav ml-auto"><li id="menu-item-27" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-27 nav-item"><a href="http://www.hebi.local/" class="nav-link">Home</a></li>
<li id="menu-item-28" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-23 current_page_item menu-item-28 nav-item active"><a href="http://hebi.local/about/" class="nav-link active">About</a></li>
<li id="menu-item-29" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-29 nav-item dropdown"><a href="http://hebi.local/gallery/" class="nav-link dropdown-toggle" data-toggle="dropdown">Gallery</a>
<div class="dropdown-menu">
<a href="http://hebi.local/gallery/bespoke/" class=" dropdown-item">Bespoke</a><a href="http://hebi.local/gallery-type/collections/" class=" dropdown-item">Collections</a></div>
</li>
</ul>
        <a class="navbar-brand logo animate d-none d-sm-block" href="http://hebi.local">
                      <img class="animate" src="https://www.hsdtaxlaw.com/wp-content/uploads/2016/05/logo_placeholder.png" alt="Logo">
                  </a>
        <ul id="menu-right" class="navbar-nav mr-0"><li id="menu-item-35" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-35 nav-item"><a href="http://hebi.local/contact/" class="nav-link">Contact</a></li>
</ul>
        <div class="external mr-auto">
          <a href="https://www.etsy.com/shop/HebiCorsetry" class="btn btn-primary shop-btn">Shop</a>
          <a href="https://www.facebook.com/HebiCorsets/" class="btn"><i class="fab fa-facebook-f"></i></a>
          <a href="http://i%20class=fab%20fa-instagram/i" class="btn"><i class="fab fa-instagram"></i></a>
        </div>
      </div>
    </div>
  </nav>

And here's the custom CSS styles used:

.navbar {
      margin:0;
      border:none;
      border-radius:0;
      background-image: none;
      text-transform: uppercase;
      background: #000;
      font-family: 'Cinzel', serif;
    }

    .logo a {
      display: block;
      position: relative;
      max-height: 100px;
    }
    .logo img{
      max-width: 200px;
      max-height: 100px;
      padding: .5rem;
      -webkit-transition: all ease .2s;
      transition: all ease .2s;
    }

    .navbar a {
      color: #cc0000;
    }

    .navbar .btn-primary {
      background: #CC0000;
      border: solid #CC0000;
      color: #FFF;
    }
    .navbar .btn-primary:hover {
      background: #F81717;
      border: solid #F81717;
      color: #FFF;
        -webkit-transition: background-color .3s ease;
      transition: background-color .3s ease;
    }

    .navbar-nav ul{list-style-type: none}
    .navbar-nav li .dropdown-menu li a{line-height: 50px; height: 50px;}
    .spacer{height: 50px;}
    .no-margin{margin:0; padding:0;}

    .navbar li a {
      -webkit-transition: color ease .2s;
      transition: color ease .2s;
      display: inline-block;
      padding: 0 15px;
      font-weight: 400;
      letter-spacing: 2px;
      font-style: normal;
      text-transform: uppercase;
      }

Answer №1

Upon reviewing your code, it appears that you have not specified a height for any element besides the logo img, which only has a max-height defined. This lack of height specification could be causing the issue with your navbar, as its height depends on this element. To resolve this problem, consider setting a fixed or min-height for your img.

.logo img{
  max-width: 200px;
  min-height: 100px;
  max-height: 100px;
  padding: .5rem;
  -webkit-transition: all ease .2s;
  -moz-transition: all ease .2s;
  -ms-transition: all ease .2s;
  -o-transition: all ease .2s;
  transition: all ease .2s;
}

Answer №2

Have you considered setting a height for the navbar element? Adding a height value could improve the overall appearance and consistency of the design across different browsers.

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 functionality of ItemSliding appears to be disabled when used in combination with

Could you please help me figure out why the Me button is not visible? I implemented the ItemSliding component. Here is the link to the stackblitz project. The issue is within the home folder. I am trying to create a list like the one below: UI https:// ...

Learn how to dynamically update the dropdown text in bootstrap-vue.js

This is the dropdown code I am currently using: <b-dropdown size="sm" text="Update" split class="m-2"> <b-dropdown-item-button>Action</b-dropdown-item-button> <b-dropdown-item-button>Another ...

The icons within the <i> tag are failing to appear on my Ionic webpage

Trying to incorporate the tag icon in the HTML, but encountering issues with displaying the icon. Here is the code snippet I am using to display the icon, but unfortunately it's not appearing: <i class="fas fa-plus"></i> Intere ...

Ways to prevent a div from loading an HTML page

When an external button is clicked, the remove() function on id main is triggered. The issue arises when a user quickly clicks on btn1 and then presses the external button, causing the removal to occur before the event handler for btn1. This results in the ...

Create a copy of an element without altering the original

Currently, I am attempting to create a duplicate of a class and ensure that it remains unaffected when the original is altered. So far, I have tried: $(".newclass").addClass("oldclass"); However, this method does not copy the content. var _elementClone ...

List within a list that is only displayed if a specific condition is

Looking for help with CSS styling to make an embedded list display as a contiguous list in the final output. Here's the scenario: <ol> <li>Coffee <! -- embedded unordered or ordered list - begin --> <ul> <li>Ap ...

HTML structure consisting of a 3 by 3 grid

Creating a 3x3 grid with cells that have varying heights depending on content is proving to be challenging. Except for the cells marked with red arrows, the rest of the grid has fixed height in pixels. I attempted to build a 3x3 grid using divs to experi ...

How can we use jQuery to extract an HTML element's external stylesheet and add it to its "style" attribute?

My goal is to extract all CSS references from an external stylesheet, such as <link rel="stylesheet" href="css/General.css">, and add them to the existing styling of each HTML element on my page (converting all CSS to inline). The reason for this re ...

what strategies can be implemented to prioritize addressing validation errors in return forms

I'm currently working on a web application in asp.net mvc-5, and I have a contact form displayed in the middle of the Contact Us view. Here's the code snippet: <div class="col-sm-8 col-sm-push-4"> <h2>Contact Us1 ...

Building a Sleek Hover Effect Dropdown Menu Using HTML and CSS

I've been following a tutorial on YouTube that showcases how to create a hoverable dropdown menu using HTML and CSS. The video link can be found below: Youtube Video Tutorial: https://www.youtube.com/watch?v=9Qrs8p7WgCc After replicating the code an ...

How to incorporate Django syntax into CSS styling

Imagine a scenario where a Django site is equipped with numerous stylesheets. CSS and JS files are located in the static/ directory within an app's folder or in the global site directory. Various color themes are employed across different pages, neces ...

Following the transition to Laravel version 8.x from 7.9.2, there seems to be a glitch in the user interface when utilizing $user -> links() function. It

After updating a Laravel project to version 8.x from 7.9.2, everything seems to be working fine except for this buggy frontend issue. It appears to be related to Bootstrap. Can anyone assist in identifying the problem? The arrows for navigating to the next ...

Issue with the <authorization> node in the Web.config file

Whenever I include <authorization>, the page is displayed without the CSS. Does anyone have any thoughts on why this might be happening? Below is my web.config: <?xml version="1.0"?> <configuration> <connectionStrings> <a ...

Maintaining the layout of two columns in Bootstrap 4, responsive design turns them into a single stacked

Currently using Bootstrap v4 with a two-column layout that splits the container in half. On larger screens, the items in each column display correctly. However, on smaller screens, Bootstrap shuffles the items from column 2 into column 1. I am looking to ...

Issues with the OnChange function not properly functioning in duplicate input fields

I've designed a form that allows for adding or deleting rows, effectively cloning input fields. One of the input fields utilizes Jquery Ajax to retrieve its value. However, upon adding an extra row by cloning the parent row to generate a child row, th ...

What is the code to position the brand name to the right of a logo in HTML?

As I work on building my webpage, I am facing an issue where I want the brand name to appear directly next to the logo, on the right side. I have attempted to use the float-left property without success. I've included both the HTML and CSS code here. ...

What is the best way to optimize HTML and Flask code to initially load the bootstrap table and then dynamically refresh the data table with each new dictionary item?

Utilizing flask and bootstrap, I am in the process of developing a website involving tensor-flow. Currently, users input code into a form, which triggers flask and html code to load the page after completing all data computations. This results in significa ...

Utilize an array with dynamic referencing

I am attempting to reference a single index out of 30 different indices based on the user's actions, and then utilize ng-repeat to iterate through each item in the index. Controller: $scope.meals = [ { title: 'Abs', url:"#/app/mworkout ...

Issue encountered when sending information to asmx web service via ajax and displaying the result on an HTML page with a javascript function

I have developed an ASMX web service that looks like this: [ScriptService] public class CurrencyData : System.Web.Services.WebService { [WebMethod] public string DisplayCurrency(double amount, string sign ,string style) { swi ...

Error message: JavaScript multiline strings within backticks are currently unsupported in Internet Explorer

My HTML string, stored in a variable, is being used to populate the innerHTML. Although the first example (using backtick syntax) is simple, it does not function in Internet Explorer 11. Is there a way to make the first example work in Internet ...