Unusual Blank Space Found Beneath a Displayed Block Item

I've noticed some odd whitespace appearing under all my display: block elements within a meganavigation. Despite adding the code snippet below (which also determines column widths), I can't seem to pinpoint what's causing this issue. Whenever the meganav generates, the items set as "display:block" have an unnecessary space underneath them. This is also visible when hovering over items in the main navigation. Any suggestions on how to tackle this problem?


a {
font-family: "Frutiger LT Std 45 Light", sans-serif;
color: black;
text-decoration: none;
font-size: 10px;
display: block;
padding: 3px;
}

a:hover {
text-decoration: none;
color: white;
background-color: #c8a51b;
}

.nav {
background: #1b2c69;
width: 800px;
margin: 10px;
height: 30px;
}

.nav li {
list-style: none;
}

.nav > li {
padding: 0;
float: left;
position: relative;
}

.nav > li > a {
font-family: "Frutiger LT Std 45 Light", sans-serif;
float: left;
color: #fff;
font-size: 13px;
text-decoration: none;
line-height: 30px;
padding: 0 20px;
height: 43px;
text-transform: uppercase;
}

.nav > li:hover > a {
background: #FFF;
color: #1b2c69;
}

HTML:

<ul class="nav">
<li><a href="#">Home</a>

</li>
<li><a href="#">Our Company</a>

<div class="tab1">
<div class="container-1">
<div class="col1"> 
    <a href="#">Business Reports</a>
    <br> 
    <a href="#">Core Values</a>
    <br> 
    <a href="#">Corp Priority Updates</a>
    <br> 
    <a href="#">Critical Success Factors</a>
    <br> 
    <a href="#">Daily Reports</a>
    <br> 
    <a href="#">EBIT Chart</a>
    <br> 
    <a href="#">HyVisability Scorecard</a>
    <br>  
    <a href="#">Mission Statement</a>
    <br> 
    <a href="#">Quality Vision</a>
    <br> 
    <a href="#">Strategic Vision</a>
    <br>
</div>
</div>
</div>
</li>

Answer №1

Take a look at this link

I've included a bgcolor to the background to highlight the white space.

The solution is as follows:

.nav > li > a {

font-family: "Frutiger LT Std 45 Light", sans-serif;
float: left;
color: #fff;
font-size: 13px;
text-decoration: none;
line-height: 30px;
padding: 0 20px;
height: 30px;
text-transform: uppercase;

}

In the CSS above, I changed height: 43px; to height: 30px;

This modification ensures that the height for all li tags remains uniform in your scenario to achieve the desired outcome. I hope this explanation helps you understand.

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

Guidelines for utilizing the php mail() function

It seems that there is an issue with this code when running it on a local host versus a live server. I am attempting to use this code for a mail function, which works on another site but not on this one. I know the code will produce an error on localhost ...

What is the method for superimposing a div with a see-through input field?

I am currently designing a compact upload feature. It consists of a responsive element (actually a vue/quasar card) that adjusts in size according to the window dimensions and viewport. Within this element, there is a form containing an input field and a ...

Is it possible to create a list item animation using only one div element?

I'm currently working on achieving a dynamic animation effect for list items similar to the one demonstrated in Pasquale D'Silva's design example: https://medium.com/design-ux/926eb80d64e3#1f47 In this animation, the list item disappears wh ...

HTML/JS Implementation: Back to Top Visual Element

- This website appears to be quite simple at first glance. However, I have encountered an issue where every time I scroll down and then click on the "About" menu option, it abruptly takes me back to the top of the page before displaying the section with a ...

Swapping out a <DIV> element following a specified duration

Looking to swap out DIV-A with DIV-B on a landing page after 10 seconds. After some research, it seems like JQUERY is the best option, but I'm unsure about how to proceed. Most solutions involve cycling through DIVs or replacing them on a button clic ...

Utilizing a CSS file within a YAML configuration in R Quarto

Is there a way to reference a css file from a yaml file in my R Quarto Book? The css file defines the theme for my Quarto document, and I want all our Quarto docs to have the same appearance. When I directly call the css file, I can customize aspects like ...

Struggling to make a basic ajax request function correctly

I've been experimenting with this code snippet in my browser's console. $.ajax({ type: 'GET', url: 'http://stackoverflow.com/', dataType: 'html', success: function() { console.log("Yes, t ...

BorderContainer and ContentPane dojo widgets combine to create a powerful layout system

Currently, I am in a traineeship at a company where I need to use a program developed by another trainee back in 2012. I have made some updates to the program, but encountered an issue: In the original report, the web page had a layout with a column on th ...

Compatibility Issue between Jquery UI CheckBox Button and Click Function in IE8

Situation: After calling addButton() function in jQuery, the checkbox element is successfully turning into a button. However, the click event that should trigger an alert message is not functioning. This issue seems to be specific to IE-8 compatibility. ...

Determine the precise x and y coordinates of a centered element using JQuery

How can I determine the exact left and top positions of an element? The parent container has text-align: center, causing potential confusion when there are multiple elements on the bottom row. For instance, the first one may have a position of 0px instea ...

Reverting Changes Made with JQuery Append

I have a table where each cell contains a button. When the button is pressed, it adds text to the cell. I am looking for a way to remove this text from the cell when the same button is pressed again. It's important to note that this button appears mul ...

Display a symbol retrieved from the backend server

After receiving a response from the backend server for my Angular 2/4 application, I am presented with an attribute called "connectionStatus". This attribute indicates the status of a database connection, either as "UP" or "DOWN". In order to display this ...

Utilizing the GROUP BY clause within an INNER JOIN operation, and presenting the results in an HTML dropdown menu

My database includes the following tables: Workers (id, total_pay, date_of_pay, projects_id) Payments (id, payment, date, projects_id) building_materials(id, pay_of_materials, date, projects_id) additional(id, add_pay, date, projects_id) All tables have p ...

Adding HTML elements dynamically using jQuery: A how-to guide

My objective is to start with one element upon loading the page, and this element should have an ID of "something_O". When the user clicks on an add link, a new identical HTML element should be added underneath the existing element. The new element should ...

What is the best way to create a "tile-based board" for this game?

I am working on a project to create a board made up of tiles, but I am facing difficulty in filling up the entire board area. Currently, I have only managed to create 1 column of the board, as shown in the image. Can someone guide me on how to fill the ent ...

What is the best way to place a single button above a row using the bootstrap btn-group?

I currently have 11 buttons arranged in 3 rows, and I am trying to position one button at the top as a standalone element before the two rows of buttons. However, despite experimenting with various flex-end and content align classes, I have not been succ ...

What is the method to assign multiple values to ng-disabled in AngularJS?

Is there a way to assign multiple values for ng-disabled in AngularJS? The issue I'm facing is demonstrated in the following JS Fiddle: http://jsfiddle.net/FJf4v/10/ <div ng-app> <div ng-controller="myCnt"> <h3>A ->> ...

What is the best way to close the space between a box-shadow and a div background when incorporating semi-transparent rgba() values?

There seems to be an issue arising when applying partially transparent rgba() background-color and box-shadow color values to an element with a non-fixed (percent-based) border-radius. This combination results in a minuscule transparent gap appearing at th ...

Using JavaScript to convert the text within a div into negative HTML code

I am working with this specific div: <div class="signs" id="signs" onclick="toggle()">&#43;</div> It currently displays the positive sign. I have set up a JavaScript function that is triggered when the div is ...

The app is opening the index.html file instead of the expected index.jsx file

After creating a page with React.jsx, I encountered an issue where my page was initially opening index.jsx upon running npm start. However, when I deleted and then restored the index.html file to "public", the page started opening index.html instead. This ...