Excessive Header Length Exceeding Page Limit

I've been struggling to pinpoint the reason why my page is displaying with a longer header than the actual page length. Even after adjusting the header size to be less than 100%, there is still excess white space overflowing beyond the edge of the page. Despite attempting to debug by removing various sections of code, I am unable to identify the root cause of this issue. Below is the HTML snippet for reference and you can find the complete CSS on JSFiddle through this link: http://jsfiddle.net/2qVUg/

<body>
<div id="header">
<img src="x" height="66" width="427" id="logo" />
<ul id="unordered">
  <li><a href="#">Link 1</a></li>
  <li><a href="#">Link 2</a></li>
  <li><a href="#">Link 3</a></li>
  <li><a href="#">Link 4</a></li>
    <li><input type="text" /></li>
    <li><img src="x" height="15px" width="15px" /></li>
</ul>
</div>
<div id="body">
<div id="main">
    <p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
</div>
    <div id="controls"><form action="#" method="POST">Enter a Comment: <br /><textarea sizable="false"></textarea><br /><input type="submit" value="submit" /></form></div>
</div>
<div id="footer"><p></p></div>
</body>

Your assistance in resolving this matter is greatly appreciated.

Answer №1

the issue is caused by the padding-left: 80px applied to the #header, which is extending the header too far past the content

To fix this, consider placing the content in a container and using margin-left: 80px

Check out the JSFIDDLE link for more details

Answer №2

It has been pointed out by jmore009 that there is a problem with the header's width and padding settings.

width:100%;

Combined with

padding-left: 80px;

This causes the header to exceed its containment, as it tries to be 100% + 80px wide.

The solution suggested is to apply the padding directly to the logo image:

header img{margin-left: 80px;}

This method would work if there was only one image in the header. However, since there are two images, an alternative approach is recommended.

One option is to enclose the logo within a div element (preferably):

<div id="logo></div>

#logo{margin-left: 80px;}

Alternatively, you can add the margin to the existing logo ID:

#logo{margin-left: 80px;}

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

When it comes to using brackets and HTML, I keep receiving an error message indicating that there is no index file

I'm having trouble with this code - it works fine in Code Academy, but I am new to HTML and trying to practice outside of the platform. Every time I try to live preview in Brackets, I get an error message saying "make sure there is an html file or tha ...

Disabling buttons in a Fiori UI5 application using HTML: A step-by-step guide

I don't have much experience with scripting languages. I am attempting to hide buttons within a SAP Fiori app by using the "Inspect element" tool in the Mozilla browser. When I delete the HTML code, the button disappears, but I would like to accomplis ...

Retrieve the ng-option key in AngularJS

As a beginner in Ionic, I am working on adding a drop-down for countries to my registration page. I have successfully populated the drop-down with data from the response, but I'm struggling to retrieve the key value when an item is selected. Below is ...

Eliminating the boundaries of Bootstrap accordion

I'm currently working on creating Bootstrap accordion menus and I'm attempting to remove the border that appears when it's collapsed and expanded. Below is the code I've been working on: <div class="accordion"> <div ...

Tips for creating an easyui layout using multiple nested layouts

I have integrated easyui nested layout into my application. I followed the code snippet provided in the easyui demo. <div class="easyui-layout" style="width:700px;height:350px;"> <div data-options="region:'north'" style="height: ...

Toggle a DIV's class using jQuery upon clicking a link, then hide the link and reveal the hidden information inside the DIV. This functionality can be applied to multiple

My main objective is to create a product page that showcases multiple product images within the productLayout DIV. When the link within this DIV is clicked, it should add the class pL100, expanding the width of the DIV to reveal hidden content within the h ...

How to iterate dynamically over arrays using JavaScript

I am working on a JavaScript project where I need to create a graph with 25 different data points. While my current JavaScript method is effective, I am facing an issue - I have multiple arrays and I am looking for a solution that allows me to use a for lo ...

Volkswagen elements spilling over

Why are two divs overlapping each other? I have divided the two divs equally with viewport width. When I set the width to 49% instead of 50%, the code works fine. Why is that? <!DOCTYPE html> <html lang="en"> <head> <meta charse ...

The versatile nature of the flex-direction CSS property

I am attempting to customize the layout of the code available at https://codepen.io/rperry1886/pen/KKwbQNP in order to showcase the images in a horizontal sequence rather than vertically. Despite referring to resources on Flexbox like https://css-tricks.co ...

Automatically update the div every few seconds and pause when it has loaded successfully

I am facing a challenge in creating a div that refreshes automatically every 10 seconds, but stops when it successfully loads. Here is the jQuery script I have developed: <script type="text/javascript"> $(document).ready(function(){ var j = jQuer ...

Azure Chatbot that logs conversations in Webchat whenever the user selects 'none of the above' option

Recently, I've delved into the world of web chat services and embarked on a journey to craft a chat bot using pure JavaScript code that can seamlessly integrate into any HTML file. Despite consulting Microsoft's documentation, I find myself in a ...

Section of links spanning 4 columns in full-width

Planning to design a 4 column link section for an upcoming website, aiming to achieve the look in the provided screenshot. https://i.sstatic.net/pydBp.png Each box will serve as a clickable link, changing color on hover. Utilizing the Bootstrap framework ...

Issue with CSS not getting applied to content placed within modal dialog on Internet Explorer

After writing some code, I encountered a situation where I have multiple jQuery UI modal dialogs. I decided to remove the default title bar provided by jQuery in these modal dialogs. The code snippet I used within the create function in the dialog code to ...

Is a library a necessary component for app development?

Embarking on my coding journey, I found myself at a loss for where to begin. After some research, I decided to start by learning the Javascript language. Completing courses on freecodecamp left me with uncertainty about what to do next - overwhelmed by t ...

The div elements are constantly shifting positions when viewed in Internet Explorer

After completing my website and testing it across different browsers, I noticed an issue with IE. The contact div and navigation shift around the page in this browser specifically. Can anyone help me out with some code to fix this problem? Link to live ex ...

Expanding iframe elements

I am having difficulty adjusting the size of the iframe content (within a fixed-sized iframe). Essentially, I would like the content to scale smaller or larger as if the browser's zoom function was being used. Through my CSS experiments, it seems achi ...

Ignoring Bootstrap Popover Placement Setting

Within my Bootstrap modal, there is a select element with options that each have detailed descriptions in Bootstrap popovers. Despite trying different values for the placement option in the popover initialization, the popover consistently appears in the mi ...

Whenever I attempt to use window.print(), the styling gets completely messed up. I've experimented with both @media screen and @media print, but unfortunately, I

I am working on creating an invoice, the design looks perfect in the browser, but when I try to window.print() the style gets corrupted. I attempted to include @media screen and @media print, but I am still facing the same issue. The invoice form is incorp ...

Responsive Button Sizing with Bootstrap 4

Would it be possible to use Bootstrap 4 to automatically apply the 'btn-sm' class (small button) when the media breakpoint is xs? I want the buttons to remain their default size unless the screen size is xs, where they should switch to btn-sm au ...

What is the best way to align the main navigation at the center of

Even though I have utilized text-align: center, the style of .main-nav did not change. What is the most effective way to center this navigation menu? /***** Navigation *****/ .main-nav { font-family: 'Lato', Helvetica, Arial, sans-serif; f ...