The header of my website requires adjustment to correct the horizontal line at the top

I am having an issue with a horizontal line separating my header from the body content. I want it to stay in place when scrolling, but when I try to set it to a 'fixed' position, it behaves strangely. Can someone please assist me with this problem? Thank you.

Below is the HTML code:

     <div id="wrapperfull">

     <div class="fitter">

     <div id="head">

     <div id="header">
     <a href="index.html"><img src="../Images/Header2.png" width="379" height="99" alt="Just Joel Header"></a>
     </div><!-- end header div -->

     <div class="navigation">

     <div class="menu-holder">

     <ul class="menu">

        <li><a href="index.html">HOME</a></li>

        <li><a href='print.html'>WORK</a>
      </li>

        <li><a href="photography.html">PHOTOGRAPHY</a>
      </li>

        <li><a href="blog.html">BLOG</a>
      </li>

        <li><a href="inspired.html">INSPIRED</a>
      </li>

       </ul>
     </div>
     <!-- menu-holder end -->
     </div><!-- end navigation div -->     


     </div>


     </div>

     <div class="bottom-color">
     </div>

     <div class="heading">

     <h1>SHOWCASE</h1>

     </div>

And here is the CSS code:

    #wrapperfull {
min-height: 100%;
width: 1050px;
border: thin;
border-color: #00BDE5;
margin-top: 0px;
background-color: #FFF;
position: relative; /* for the absolute positioned footer */
margin: auto;
margin-bottom: auto;
padding-top: 0.1px;
padding-right: 40px;
padding-bottom: 0px;
padding-left: 30px;
    }

    .fitter {
height: 115px;
width: 1050px;
background-color: #FFF;
    }

    .bottom-color {
height: 15px;
color: #00BDE5;
border-style:solid;
border-bottom-width: 1px;
border-right-width: 0px;
border-left-width: 0px;
margin-bottom: 20px;
    }

    #head {
    height: 100px;
    width: 1070px;
    border: none;
    margin: auto;
    background-color: #FFF;
    position: fixed;
    z-index: 1;
    }

    #header {
height: 125px;
width: 1050px;
font-family: Helvetica, sans-serif;
position: fixed;
background-color: #FFF;
margin-top: 0px;
    }

    .navigation {
height: 75px;
width: px;
float: left;
margin-top: 0px;
margin-left: auto;
padding-top: 20px;
font-family: "geogtq sb";
position: fixed;
background-color: #FFF;
    }

Answer №1

After running your code through testing, it appears that it functions correctly based on my understanding. Take a look at the following snippet:

It's also advisable to include 
* {
margin: 0;
padding: 0;
}

http://jsfiddle.net/4gHuT/2/

Answer №2

It is recommended to enhance it by adding a sky blue line under your navigation bar, instead of using a separate div element.

  <div class="bottom-color"> </div>

You can achieve the same effect by adding a border bottom to either #header or #head element (it seems one of them is redundant).

You may also consider simplifying your use of div elements.

Additionally, it is advisable to review your HTML and CSS code for any errors, such as;

width: px; 

found on line 54

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

Unable to send message using window.parent.postMessage when src is set to "data:text/html;charset=utf-8" within an iframe

I'm currently working on a project to develop a compact editor that allows users to edit HTML using an iframe. I'm passing an HTML string into the src attribute as data:text/html, but I'm encountering challenges with communication in the par ...

Conceal elements on smaller screens using the Bootstrap 5 grid system

I'm facing a design issue with my layout - it looks perfect on larger screens but when viewed on mobile devices, the columns stack vertically instead of horizontally. Essentially, I want to hide the first and second last column on small screens and r ...

What's the deal with using tables or divs in web design? Are they necessary or just a crazy trend?

For my upcoming project, I am eager to take on this task. https://i.sstatic.net/eVSvy.jpg The question remains: which approach should I employ - a Div or table method? ...

Optimize your Kendo components in Angular with this top-notch customization strategy

How can kendo components like grids and charts be styled in the best possible way while following recommended practices? My current methods of styling them are: 1 : Utilizing ng deep, host, however these approaches have been deprecated and are not consi ...

Guide to turning off the pinch-zoom feature on Windows 8 laptops

I'm currently working on a Windows 8 desktop application where I am using C#, JavaScript, and HTML5. Specifically in the C# portion, I am utilizing the WebView object. My goal is to disable pinch-zoom within my application. I already know how to achi ...

Is it possible for Tinymce to provide me with precise HTML content that retains all styles (essentially giving me a true WYSIWYG

I find it puzzling how Tinymce is labeled as a WYSIWYG editor when what I see visually is not exactly what I get when I retrieve the HTML using getContent(). It seems more like "what you see is just what you see." Currently, when I use getContent() to get ...

Animate CSS during page load

Currently, I am implementing AJAX to dynamically load pages on my website. During the loading process, I wish to incorporate a spinning animation on the logo to indicate that content is being fetched. The jQuery script (although I'm still learning an ...

Creating a mobile-friendly layout with 3 columns: Tips and tricks

I attempted to solve the issue independently but didn't have much success. My goal is to create a proper version for mobile users using bootstrap, however, it currently looks terrible on mobile devices. I suspect the problem lies with the div classes ...

Is there a way to adjust the background hues of a React component when a click event is triggered?

Currently, I have 3 React components that each consist of a div element. When I click on one component, I want to change its background color to black. If I then select another component, the previously selected component should return to its normal back ...

When the page initially loads, the block appears on top of the upper block and remains in place after the page is refreshed

Upon initial loading, the block appears on top of another block but remains fixed upon page refresh. The same issue occurs in the mobile version of the site and occasionally displays correctly. The website is built on WordPress and optimized using Page Spe ...

Comparison between using jQuery to append and execute a <script> tag versus using vanilla JavaScript

As I enhance my application, I've made the decision to embrace Bootstrap 5, which no longer relies on jQuery. Consequently, I am working to eliminate this dependency from my application entirely. One of the changes I'm making is rewriting the Ja ...

Twig template delivers HTML entities

I am dealing with an issue related to the twig template. Instead of displaying HTML markup, it is showing raw HTML characters. <?php /* HomepageController.php */ namespace App\Controller; use Sensio\Bundle\FrameworkExtraBundle\Co ...

Ways to reduce the width of a flex box

I am facing an issue with my main container where I have two items placed on the same line. Item 1 is an image linked to a URL and it should be positioned at the far left of the container. On the other hand, item 2 contains a font awesome icon that needs t ...

Personalized Tumblr-style button

Hey there, I've been working on creating a custom Tumblr-like button and tried adding an iframe above it to make it clickable. However, something seems to be off as it's not functioning properly. I'm still trying to wrap my head around how i ...

Issue with function operation

Incorporating HTML code with Angular elements on the homepage of a PHP forum script has been challenging. I have inserted the PHP code into index.template.php as instructed, but unfortunately, nothing is being displayed. <?php /** * This function ...

Developing and integrating views within a node-webkit desktop application

For my file copier desktop application built with node webkit, I aim to create a seamless flow where the initial check for existing profile data determines the first page displayed. The header with static links/buttons to various views remains consistent ...

Difficulty achieving transformation of one div element within another div element

My aim is to create a unique hover effect for a button where it tilts slightly without affecting the text. You can view my progress here: https://codepen.io/kyannashanice/pen/QWveOMg I tried stacking the text and button in separate divs and triggering the ...

Mobile navigation bar with Bootstrap transparency

I recently encountered a challenge with my Bootstrap navbar where I needed to remove the background. To achieve this, I applied the class "navbar-fixed-top" to the main wrapper. <nav class="navbar navbar-fixed-top"> After making this change, the na ...

It appears that the query parameters are impacting the speed at which the page loads

I am currently developing a project on this platform. It is using c9.io, an innovative browser-based collaborative programming IDE. The index.php file includes the following script: <?php $path = ltrim($_SERVER['REQUEST_URI'], '/&ap ...

How to smoothly transition a div from one location to another using animations in an Ionic3-Angular4 application

I'm attempting to incorporate some animation into my Ionic 3 mobile app. Specifically, I want to shift a div from one location to another. In the code snippet provided below, I am looking to move the div with the "upper" class after the timeline-item ...