What could be causing the issue with the width: 100% not rendering correctly in this

I'm currently working on my footer, but I'm having trouble getting the width: 100% tag to work correctly. Here's a screenshot of what I mean:

http://gyazo.com/9c23897cd7b9a74ca55ee9fb977f810c

This is my CSS code:

/*..Portfolio - Lars Beute..*/
body{
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
}
header {
    background: #00795f;
    width: 100%;
    padding: 40px 0;
    color: white;
    text-align: center;
}
a{
    text-decoration: none;
    color: inherit;
}
nav ul{
    background-color: #42a286;
    overflow: hidden;
    color: white;
    padding: 0;
    text-align: center;
    margin: 0;
}
nav ul li{
    display: inline-block;
    padding: 20px;
}
nav ul li:hover{
    background-color: #399077;
    border-bottom: 3px solid white;
}
section {
    line-height: 1.5em;
    font-size: 0.9em;
    padding: 40px;
    width: 75%;
    margin: 0 auto;
}
.current{
    border-bottom: 3px solid white;
}
#intro{
    text-align: center;
    background-color: #E6E6E6;
    width: 100%;
}
#intro h1{
    font-size: 50px;
}
#intro em{
    opacity: 0.4;
}
#box1 {
    width: 100%;
    height: 300px;
    background-color: #1A1A1A;
    max-width: 100%;
    max-height: 100%;
    color: white;
    text-align: center;
    vertical-align: middle;
    line-height: 300px; 

}
#footer1 {
    background: #00795f;
    width: 100%;
    height: 100px;
    color: white;
    text-align: center;
    vertical-align: middle;
    line-height: 100px; 
}

This is the HTML code that accompanies it:

    <!--Portfolio by Lars Beute-->
<!--Copying not allowed under my permission-->
<!DOCTYPE html>
...

I am trying to have the footer extend all the way to the bottom of the page.

Thank you for your assistance!

Answer №1

The issue arises from placing your footer within a <section> element with properties of width:75% and padding:40px.

To resolve this, adjust your code as follows:

<footer id="footer">
  <!-- code -->
</footer>

JSFiddle

Be sure to remove the <section> tag encasing the <footer> section.

The reason behind the malfunction is that you are defining the dimensions based on its parent element, which in this case is only 75%, resulting in an incorrect display of 100%.

Answer №2

Since the element is enclosed within a section that contains CSS styling, such as:

section {
   line-height: 1.5em;
   font-size: 0.9em;
   padding: 40px;
   width: 75%;  <<< specifically this right here
   margin: 0 auto;
}

You have the option to either remove it from the section (convert it to a div) or target the custom ID and adjust the width to 100%. Using <footer> is also recommended for simplicity.

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

Looking to determine if a specific element is assigned multiple class names

Help needed! Can you tell me how to check if an element contains more than one classname using pure javascript, without using jQuery? For example: If #test has both the classnames "classA and classB", then { alert(true) } else { alert(false) } Here is ...

Retrieving Table Cell Values Using Jquery: A Step-by-Step Guide

<table class="table" align="center" id="tblMain"> <tr> <td>Status</td> <td><b><span name="current" value="Dispatch">Dispatch</span></b></td> </tr> </table> JS $(&apos ...

Learn how to deactivate the pause button with just one click and re-enable it once the popup appears using Angular2 and Typescript

Can anyone assist with solving an issue I am facing with a timer and a pause button? I need the pause button to be disabled once clicked, until a popup appears, then it should become enabled again. My code snippet is provided below: HTML: <button md-i ...

Within the flask framework, I am experiencing an issue where paragraphs are being overwritten. My goal is to find a

Snippet of HTML: <div class="split left" > <div class="centered"> <div class="container"> <p>Hi!</p> </div> <div class="darker"> <p>{{message}}& ...

Utilizing Scrollify for seamless section scrolling with overflow effects

I have been experimenting with the Scrollify script (https://github.com/lukehaas/Scrollify) and facing an issue where my sections are longer than the user's screen, requiring them to scroll down to view all content. However, Scrollify doesn't al ...

What could be the reason that the painting application is not functioning properly on mobile devices?

I am facing an issue with my painting app where it works perfectly on desktop browsers but fails to function on mobile devices. I tried adding event listeners for mobile events, which are understood by mobile devices, but unfortunately, that did not solve ...

Modifying the color of the tooltip arrow in Bootstrap 4: A step-by-step guide

How can I change the arrow color of the tooltip using Bootstrap 4? Here is my current code: HTML: <div class="tooltip-main" data-toggle="tooltip" data-placement="top" data-original-title="Service fee helps Driveoo run the platform and provide dedicate ...

Submitting information via jQuery

https://i.stack.imgur.com/VU5LT.jpg Currently, I am working on integrating an event planner into my HTML form. However, I am facing difficulty in transferring the data ("meetup", "startEvent", "break") from HTML to my database. Using jQuery, I was able to ...

Issue observed with alignment not being corrected when the browser is resized on a responsive webpage

Utilizing Bootstrap3 for my responsive page design. In the banner content, I am including a box with text inside: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> <s ...

Delete the CSS class from a specific HTML element

Having just started learning HTML and CSS, I encountered an issue. I applied a CSS class to a table element. Subsequently, I inserted a child table within the parent table. The problem arose when the CSS class of the parent table also influenced the child ...

Tips on handling a nested HTML hyperlink in Selenium using Python with IE11

Can anyone assist me in resolving the issue of clicking on a hyperlink within an HTML page that contains nested HTML elements up to 4 levels deep? I have attempted various methods using XPATH, but they do not seem to work during runtime. I am utilizing Sel ...

What is the best way to halt the ticking of this clock in JavaScript?

I can't seem to figure out how to stop this clock using JavaScript Even though I press the stop button, the clock keeps running <!DOCTYPE html> <html> <head> <h1> Welcome to the clock. Press the stop button to halt the clo ...

Get the value of the button that has been clicked

I have a query regarding building a website that can be started via PowerShell. The PowerShell HTML code I am using is: $proxys = "" foreach ($email in $ADObj.proxyAddresses){ $proxys += "<button id='$email' name='alias&apo ...

Using jQuery to add the input from a dynamically loaded Ajax select list to a different form prior to submission

Let's simplify the code for this question: I have two HTML forms with IDs of 'header' and 'existing' In the 'existing' form, there is a select element where the options list is loaded dynamically using Ajax based on sea ...

What is the best way to incorporate visual indicators into specific columns containing certain keywords?

Is there a way to customize the script code responsible for displaying table data so that icons automatically appear next to specific keywords in the Gender column? For instance, can we have an icon like glyphicon glyphicon-heart-empty for Male and glyphic ...

Incorporate a horizontally rotating preloader to enhance loading experience

I am currently in the process of developing a preloader that rotates an image horizontally. After researching different threads and ideas, I came across a solution that looks something like this: <style> .imageRotateHorizontal{ -moz-anima ...

The absence of color attribute in CSS serves as a safeguard against overriding

Issue Update: Upon pushing the application to the development server, ASP includes injected styles that are overriding the necessary custom styles. One specific example is a wrapper div with an 'a' tag that overrides all styled 'a' tags ...

Are there ways to implement Vue.js transitions without directly setting the height in the code?

I'm having an issue with a Vue app I created where I need to make an element expand and collapse when a button is clicked. I want the effect to be smooth and animated, but using the <transition> tag alone isn't working as expected. The prob ...

Database not receiving input data from AngularJS form submission

Having some trouble saving form data to the database using angularjs. Not sure what I'm doing wrong. Here's my HTML form: <form id="challenge_form" class="row" > <input type="text" placeholder="Challenge Name" ng-model="ch ...

The xpath identifier in Selenium Python 2.7 for Chrome is dynamically changing with each instance

I have encountered another issue. I previously asked a similar question and tried the suggested method, but it did not work for this specific problem. The HTML code for this element is related to Filters. The main issue is that there is a toggle button th ...