The alignment for Bootstrap's NAV element within a display:table-cell element seems to be off when viewed on Firefox浪

Here is an example of HTML markup with Bootstrap library included:

<div class="container">
  <div class="card">
    <ul class="nav list">
      <li class="element">
        <a href="#">Element</a>
        </li>
      <li class="element">
      <a href="#">Another element</a>
        </li>
    </ul>
    <div class="content">
     <div>
       First content
     </div>
     <div>
       Second content
     </div>
    </div>
  </div>
</div>

Also, take a look at the CSS code provided:

.container { 
  display: table;
  layout: table-fixed;
}
.card {
  display: table-row;
  width: 300px;
}

li {
  display: inline-block;
  background-color: red;
  padding: 20px;
}

.list {
  display: table-cell;
  width: 100px;
  white-space: nowrap;
}

.content {
  display: table-cell;
  width: 200px;
  background-color:blue;
  height: 200px;
}

There seems to be some issue with how Firefox and Chrome are rendering this code differently. Firefox adds extra padding/margin to the table-cell div with navbar, causing misalignment with the content table-cell above. Here are screenshots showing the difference:

https://i.sstatic.net/vhbHq.png

https://i.sstatic.net/AUlIs.png

If anyone has encountered this problem with Firefox and Bootstrap before, any help would be greatly appreciated. Thank you in advance!

For a live demo, check out this link: https://jsfiddle.net/9cztjd6o/3/

Answer №1

This empty space is a result of the default bootstrap ":before" styles. To remove it, you can use the following code:

.container:before, .list:before {
  display: none;
}

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

What could be causing the image not to appear on the React app?

I'm currently working on a react website, and I'm facing an issue with the image display on the single product page. Despite trying to tweak both the react and CSS code, I haven't been able to resolve the problem. Below is my react file: im ...

A guide on incorporating Bootstrap Toggle in your PHP project

I'm trying to style a checkbox to look like the ones on If I use this HTML input field: <input checked data-toggle="toggle" type="checkbox">, it resembles the desired design. However, I'm unsure of how to make it function as a real checkb ...

My website, powered by Wordpress, is currently experiencing an issue with excessive whitespace being added to the bottom of the contact form 7 plugin. I am perplexed as to the cause of this issue and

Recently, I've come across an issue with my contact form 7 plugin, which has been integrated into the front-page.php file using the code below: <div id="contact" class="pad-section"> <div class="container"> <h1>Contact Us</ ...

Swap out the string variable when it is modified

To generate a string inside the "code" variable that combines the selected image values, the final code should appear similar to: "test1/A=1a/B=1b" or "test2/A=1b/B=1a", etc. If the user modifies icon "A," it should replace the value in the code instead of ...

Looping CSS text animation with typing effect

I am struggling with a CSS code that types out text, but it only does so once and I need it to repeat infinitely. Despite adding animation-iteration-count: infinite;, it still doesn't work as intended. Another issue is that it slows down at the end. H ...

What's the best way to position the <li> element beneath the hamburger icon?

Is there a way to place the list element 'Home' below the hamburger icon and logo in Bootstrap 4 in mobile mode? I attempted to display the logo as style="display: block" with no success. <div class="container"> <nav class="navbar nav ...

The iPhone display scaling issue is causing difficulty viewing the entire website

Currently experiencing difficulties with a page that lacks sufficient content, resulting in a smaller height. As a result, the iPhone is scaling the page and cutting off the full menu bar (960px wide). I attempted to set a minimum height using a media quer ...

What is the best approach for rendering HTML on a page both initially and dynamically as it is updated, given the heavy utilization of ajax?

One challenge faced by many web applications today is how to efficiently reuse html templates without redundancy when initially rendering a page and adding new content. What is the most effective approach for this? One option is to render the HTML page ...

Retrieving data from Mouse Hover popup with Selenium in Python

I have a project where I'm utilizing Selenium to automate tasks on a website. There is an interactive mouse hover box that appears to provide relevant information for users. Below is the HTML code snippet for the mouse hover: <td align="center ...

Can you explain the significance of using `!important` in CSS without specifying a value?

Scenario: Currently, I am facing an issue with using the bootstrap 4 stylesheet in conjunction with NextJS. The bootstrap 4 stylesheet, compiled from SASS, contains code like: .checkbox.checkbox-accent > span { border-width: !important; } This speci ...

Guide on placing an <img> within a navigation bar

I am currently working on a Bootstrap 4 navbar that includes both a logo and text in the navbar-brand section. However, I am facing difficulties in positioning the brand-logo and text accordingly. <!doctype html> <html ...

Optimizing Animation Effects: Tips for Improving jQuery and CSS Transitions Performance

Wouldn't it be cool to have a magic line that follows your mouse as you navigate through the header menu? Take a look at this example: It works seamlessly and smoothly. I tried implementing a similar jQuery script myself, but it's not as smoot ...

What is the best way to adjust the content of a Bootstrap Column to be at the bottom of the column

Currently diving into the world of Bootstrap for my personal website, I'm encountering a challenge in aligning the content of my sidebar to the bottom. My quest for a solution led me through numerous threads without success. <!-- wordsmith: < ...

When the height of the window decreases, scrolling is not implemented

Having trouble adjusting the height of my Responsive Modal when the window height decreases. The content is slipping under the window and the scroll bar isn't adjusting accordingly. It seems like the nested div structure is causing issues. https://i.s ...

Tips for ensuring font-face displays correctly for every character

There seems to be a CSS clash that I cannot pinpoint on the site below: You can find the code snippet here: /*Font face settings for h3*/ @font-face { font-family: carrotflower; src: url('/wp-content/uploads/fonts/Carrotflower.eot') format(& ...

jquery conflict between parent div hover function and child's hover function

I am experiencing an issue with a hover function on a parent element and child event. It seems that the child hover function is not working when hovering over the parent. Specifically, I have set up a hover function on both the "univ" div and the "heading ...

jQuery UI DatePicker: without any styling, no picking dates

I'm struggling to configure a jQuery UI DatePicker. I moved the development-bundle folder contents to the directory res/jqueryui and initialized two datepickers as shown below: <script src="res/jquery-2.1.0.min.js"></script> <script sr ...

HTML5 will consistently display the video control panel

I am looking to keep the control panel of the html5 <video> element visible at all times while hiding the play/pause button. I attempted the following: <style> video::-webkit-media-controls-panel { display: flex !important; ...

Modifying Bootstrap image dimensions

I've been working on creating a card div with two images inside: an up arrow and a down arrow. Everything looks good when the page is in full screen mode, with the images displaying at their full size. However, with Bootstrap's responsive design ...

Ways to recognize when a button has been pressed

I developed my website using the CodeIgniter framework. Here is my personal website On the homepage, if I click on the "landscape" picture (top right) or the "landscape" button in the menu, it takes me to the "landscape" page. However, when I return to t ...