Header div height calculation issue: clearfix failing?

I'm in the process of revamping my website and have encountered an issue with a header div element and some child elements that are floated.

The problem is that my header is displaying a height value of 0 and not correctly calculating its content. Based on my research, it seems that this issue is likely caused by floating elements within the navigation (specifically .desktoplinkitem).

This is the code for my header:

<div class="header videohead">
 <div class="mobile-nav">
  <div class="mobile-link-container">
   <div class="mobile-links">

   <li class="linkitem"><a href="homepage">Video</a></li>
   <li class="linkitem"><a href="stills">Stills</a></li>
   <li class="linkitem"><a href="about">About</a></li>
   <li class="linkitem"><a href="emaillink">Contact</a></li>                            </div>
   </div>
  </div>
  <div class="name logo">Name<br>Title</div>
  <div class="right-nav">
   <button class="mobilemenu mobilemenu--htx">
   <span></span>
   </button>
   <div class="desktop-nav">
   <ul>

   <li class="desktoplinkitem"><a href="email-link">Contact</a></li>
   <li class="desktoplinkitem"><a href="about.php">About</a></li>
   <li class="desktoplinkitem"><a href="link">Stills</a></li>
   <li class="desktoplinkitem"><a href="home">Video</a></li>                </ul>
  </div>
 </div>
</div>

Here is the CSS styling:

.header {
    width: 100%;
    position: absolute;
    top: 0;
    z-index: 600;
    flex: none;
}

.videohead {
    display: inline-block;
}

.desktoplinkitem {
    visibility: inherit;
    color: inherit;
    background: none !important;
}

.linkitem {
    visibility: inherit;
    color: #FFFFFF;
    transform: scale(2, 2) translateX(-100px);
    opacity: 0;
}

.right-nav {
    position: absolute;
    right: 0%;
    padding: 35px;
    color: #000000;
    text-decoration: none;
}

.right-nav ul {
    height: auto;
    padding: 8px 0px;
    margin: 0px;
    float: right;
}

.right-nav li { 
    display: inline; 
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 1em;
    letter-spacing: 1px;
    float: right;
}

I attempted to add a clear fix hack, but it didn't work (using the following):

.videohead:after { 
   content: " ";
   display: table; 
   height: 0; 
   clear: both;
   *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML += '<div class="ie7-clear"></div>' );
}

You can view the page here

Is there an alternative way to resolve this issue?

Answer №1

To resolve the issue, simply delete the position: absolute; declaration from within the .logo element.

Your header remains blank due to the fact that each of its child elements has been positioned differently, either with a static or relative positioning.

The problem may also have stemmed from them floating if they were immediate children of the .header container.

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 might be causing my dropdown menu to be unresponsive in HTML?

In this HTML code, I opted to use images as dropdown elements instead of traditional buttons or text. /* Dropdown Button / .dropbtn { background-image: url(Images/Buttons/Resources3.png); width: 110px; height: 40px; } / The container <div> - neede ...

Pressing the enter key to input password

I have searched through various resources for an answer to my problem, but none of them seem to address it in a way that helps. As a beginner in coding, I may need some extra guidance. Currently, I am only able to submit a password by clicking with the mo ...

Enhancing design: creating space between div containers with Bootstrap

When utilizing Bootstrap classes like row, col-md-x, etc., to structure the content on my page, what is the correct approach to creating space between each div that contains a complete element from a semantic perspective? I have been inserting a div with ...

Dynamic item addition feature activated by button on contact form

I am looking to create a form that includes the standard name, phone, email fields as well as a dropdown for selecting products and a text box for inputting quantity. The unique aspect is allowing users to add multiple products (dropdown and quantity textb ...

Is it possible to rotate the caret in the dropdown 180 degrees using only CSS?

Is there a way to achieve a 180° rotation of the caret in a dropdown menu upon clicking it, creating the illusion of an animation? I would prefer to accomplish this using CSS only, without the need for JavaScript, but I am open to any suggestions. .se ...

Changes made to the main.css file were erased when running gulp install within the JHipser project

Just diving into the world of jhipster. I recently included a new css property in the main.css file and referenced it in the home.html. However, after executing the gulp install command, that modification vanished from the main.css. Is there a way to ret ...

The PHP code is experiencing issues on the enquiry/callback form, but it is functioning correctly on the contact form

I'm having trouble understanding why I am only getting the telephone number and missing the name and email fields when submitting a form. I have tried making changes, but I can't get all three fields to work properly. <aside clas ...

:nth-child along with endless scrolling

In the development of a website, I encountered a situation where there is a grid of items with rows that float properly thanks to a specific CSS code: .collection .grid-item:nth-child(3n+1){ clear: left; } This code ensures that the first item in ea ...

Straightforward, rudimentary example of Typescript knockout

I am hoping to successfully implement a basic TypeScript Knockout example. I utilized Nugget to acquire the TypeScript Knockout and downloaded Knockout 3.0.o js. Below is my TypeScript file: declare var ko; class AppViewModel { firstName = ko.observa ...

A guide on implementing multiple ternary operators in a Vue.js template

Is it possible for a template to return three different values instead of just two, based on the data? I am familiar with using two conditions, but is there a way to use more than two without getting a syntax error? <option {{ change === 1 ? &apos ...

Using React.js to dynamically change a CSS class depending on a certain condition

I am trying to assign a CSS class to a div based on a specific condition. The issue I am facing is that it always takes the last condition. Below is the code snippet: When I run the code, I receive logos.length as 3 <div className= "${ (this.state. ...

Generating a new DOM element for each AJAX response received

I am working on a project to build an application that fetches data about restaurants and places of interest from the Yelp API and then generates a materialize "card" for each response. Below is the code I have so far. function callback(results, status) ...

The border radius and table borders are causing the border to protrude noticeably on the right side

After much trial and error, I have almost successfully created a table with rounded corners on all four sides. The only issue is that in order for the radius property to work, I had to remove the table border property. This resulted in the td border stick ...

Extracting a string value that contains the InnerHTML for various rules

I am facing a challenge where I need to extract specific content from a string obtained from the client-side. The string contains the inner value of a DIV element, which is contenteditable and may include SPAN, P, and Table elements. My goal is to extract ...

What is the best way to ensure the navigation bar stays at the top of the window once it has reached

I have a sample js fiddle provided here. The navigation bar is positioned right below the "Hello World" section, and the content follows beneath the nav bar. Is there a way to make the navigation bar stick to the top of the window once it reaches that poin ...

Balancing spaces in flexbox

In this scenario, no matter what value is assigned to justify-content, it is difficult to horizontally align the elements around their gaps. * { box-sizing: border-box; margin: 0; padding: 0; } html, body { height: 100%; } body, div { display: f ...

Is there a way to choose the preceding element in Selenium depending on a specific condition?

In my HTML code below: <div class="row"> <div><span class="checkbox"></span></div> <a title="something"></div> </div> <div class="row"> <div><span ...

What is causing the extra space in Flexbox layout?

Currently, I am in the process of coding a layout that requires me to evenly distribute cards next to each other in rows using flex. However, I am encountering an issue with spacing on the right side and I cannot pinpoint the exact reason behind it. After ...

Failure to apply Bootstrap Stylesheet

On certain pages, I have included Bootstrap. On one particular page, I have an alert styled with Bootstrap. This is how it's defined: $('#wrongPasswordDiv').html('<br/><div class="alert alert-danger" id="wrongPWAlert" role= ...

Issue with Jquery Forms Plugin jqXHR response in Internet Explorer versions 8 and 9

I encountered a peculiar problem that only seems to occur in IE8 and 9, despite testing on Safari, Chrome (on Mac), Firefox (on PC), as well as IE versions 10 and above. Below is the code snippet causing trouble: $('#fileStore_newUpload').ajaxF ...