When the Navbar div is set to Position:fixed, it generates empty space on the page

I'm facing the issue of unwanted white space in the center of the page below the Navigation Bar. Despite numerous attempts to remove it, I haven't been successful.

Below is the HTML code snippet:

html:

<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">

<link rel="stylesheet" href="style.css"/>

<link rel="stylesheet" href="reset.css"/>

</head>

<body>

    <div class="header">

        <div class="navbar">
        <ul>
            <li><a>About</a></li>
            <li><a>Projects I've worked on</a></li>
            <li><a>Impossible List</a></li>
            <li><a>Contact</a></li>
        </ul>
        </div>
        <!-- end navbar div-->

    <div class="content">
    <p id = "title">Srikant Devarajan</p>

    </div>
    <!--end content div-->
</div>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum quidem quae magnam, facilis laborum minus provident. Earum ipsum quo voluptate cumque assumenda quia officiis, eaque suscipit error quae, maxime modi.</p>
<br>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum quidem quae magnam, facilis laborum minus provident. Earum ipsum quo voluptate cumque assumenda quia officiis, eaque suscipit error quae, maxime modi.</p>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum quidem quae magnam, facilis laborum minus provident. Earum ipsum quo voluptate cumque assumenda quia officiis, eaque suscipit error quae, maxime modi.</p>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum quidem quae magnam, facilis laborum minus provident. Earum ipsum quo voluptate cumque assumenda quia officiis, eaque suscipit error quae, maxime modi.</p>
<br>


</body>
<!--end body-->
</html>
<!--end html-->

CSS used for styling:

@import url(http://fonts.googleapis.com/css?family=Roboto:400,300);
@import url(http://fonts.googleapis.com/css?family=Lato:300);

html,body{
    height:100%;
}
.header{ 
  background: url(images/background5.jpg) no-repeat center center fixed; 
   background-size: cover;
   height:100%;
}
.navbar{
    color:white;
    list-style: none;
    font-family: "Roboto";
    text-align:center;
    padding:20px;
    background-color:black;
    opacity:1.0;
    filter: alpha(opacity=70);
    position:fixed;
    top:0;
    widows: 100%;
}

.navbar ul{
    list-style: none;
}

.navbar li{
    display: inline;
    padding:70px;
    color:#CCCCCC;
}

.navbar a:hover{
    color:#fff;
}

.nav a{
    display:inline-block;
    padding:10px;
    opacity:2.0;
}
#title{
    margin-top:110px;
    font-size:70px;
    text-align:center;
    color:white;
    font-family:'Lato';
}

.content p{
    margin-top:70px;
    font-size:35px;
    text-align:center;
    color:white;
    font-family:'Lato';
}

Answer №1

Consider treating something as stationary, causing the browser to disregard its spatial presence. The gap between elements is affected by the margin-top within your title ID. Adjust this value to observe changes in the white space.

Update: Confirmed. The margin-top within your title ID is responsible for the spacing.

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 size of the search input and textarea in HTML decreases when viewed on an iPad device

Currently utilizing Bootstrap 3 and AngularJs for this project. Implementing the following markup for the input field with type 'search': <input type="search" class="form-control" id='roomSearch' placeholder="Search" ng-model=&apo ...

Detect if the user is using Internet Explorer and redirect them to a different

My web application is having trouble rendering in Internet Explorer. In the meantime, I would like to detect if the user is using IE and redirect them to a different page specifically for IE visitors. What is the best way to accomplish this? Should I use ...

Arranging div containers with nested content

Within my application, I am dynamically displaying images side by side to users. Users have the ability to assign points to these images, and I would like to give them the option to sort the images based on points, with the highest points displayed first i ...

In PHP, the symbol "!=" is used to compare if a string is not equal to a

Seeking feedback on why setting a string variable prevents me from calling it within a function. For instance: $name = "name"; $quote_name = "'".$name."'"; //echo of $name = name //echo of $quote_name = 'name' In PHP, I encounter iss ...

Is it possible to effortlessly associate a personalized string with an identifier within an HTML element utilizing Angular2?

Check out this cool plunker import {Component} from 'angular2/core' @Component({ selector: 'my-app', template: ` <div *ngFor="#option of myHashMap"> <input type="radio" name="myRadio" id="{{generateId(option[& ...

Vertical centering issue with div specifically in Safari

I am facing an issue with centering a nested div containing a UL within another div. Despite trying various methods to achieve vertical alignment, I am unable to get it to work properly. PARENT .splash { background: url(../img/splash.jpg); backgro ...

Whenever I try to execute watir-webdriver, I notice that the CSS file is

Currently, I am in the process of learning how to utilize watir-webdriver in ruby for my QA tasks. However, a recurring issue arises when running my watir-webdriver scripts on certain sites - some pages have missing CSS Files. This particular problem seems ...

In order to properly set up Require JS, you will need to configure the JS settings

Is there a way to specify the path from any property inside the require JS config section? We are trying to pass a property inside the config like so: The issue at hand: var SomePathFromPropertyFile = "CDN lib path"; require.config({ waitSeconds: 500 ...

The modal is functioning properly on Firefox and Internet Explorer, but it is experiencing issues

Having an issue with my modal not functioning properly in Chrome. When I click on it, only the background fades and both the before and after content load in the Chrome Dev tools simultaneously with no visible content in between. Here is a link to the Cod ...

Streamlining programming by utilizing localStorage

Is there a more efficient way to streamline this process without hard-coding the entire structure? While attempting to store user inputs into localStorage with a for loop in my JavaScript, I encountered an error message: CreateEvent.js:72 Uncaught TypeErr ...

Error Encountered: Nested textarea not supported in HTML

Below is the code I am working with. The issue lies with the <textarea>. In my form, there is a textarea. When I insert another <textarea> within the ckeditor value (HTML), the inner textarea ends up closing the parent textarea. Is there a sol ...

What could be the reason the background-color isn't changing when I apply button:hover?

body{ font-family:"Arial","Lucida Grande", "Lucida Sans Unicode", Verdana, Helvetica, sans-serif; font-size:12px; } p, h1, form, button{border:0; margin:0; padding:0;} .spacer{clear:both; height:1px;} /* ----------- My Form ----------- */ .myform{ margin:0 ...

Tips for zooming to the middle of a div element

I'm trying to figure out how to create a zoom in effect on my large div, but I haven't been successful despite searching through many resources. My goal is to zoom into the center of the user's screen rather than just at a set position. ht ...

if the input field is empty, eliminate the class

Within the code snippet, a function is present which performs the following actions. It searches for an email in the input field, then converts the email to an md5 hash, and finally generates a Gravatar URL that is inserted into a class using fadeIn(); ...

How can I successfully transfer all user information when the edit button is clicked?

A new display page has been developed using php to show all user records in a table. The page includes delete and edit buttons for managing users. While the delete option is working fine, there is an issue with getting the edit button to function correctly ...

Obtain the title of the text generated by clicking the button using a script function

I am working on a piece of code that generates a text box within a button's onclick function. My goal is to retrieve the name value of each text box using PHP. <script language="javascript"> var i = 1; function changeIt() ...

Ways to ensure a form label is accessible via keyboard navigation

My HTML5 form collects user information and processes it upon submission. With the help of the jQuery Validation Plugin, input validation is performed. In case of errors, an error-message-container div is displayed at the top of the screen, listing all err ...

Refresh a page automatically upon pressing the back button in Angular

I am currently working on an Angular 8 application with over 100 pages (components) that is specifically designed for the Chrome browser. However, I have encountered an issue where the CSS randomly gets distorted when I click the browser's back button ...

XHTML markup error found: missing end tag for "div" element in W3C validation

Just finished validating my web page using the W3C markup validation service. You can find the results here. Here's what was returned: Error Line 112, Column 7: end tag for "div" omitted, but OMITTAG NO was specified </body> Info Line 16, C ...

Prevent the link from stretching to cover the entire width of the page

I'm looking for a solution that can consistently restrict the clickable link area to just the text within my h2 element. The problem arises when the space to the right of the text is mistakenly included in the clickable region. Here's an example ...