HTML and CSS problem: Footer width at 100% needed

Having a major issue here! Currently working on a Landing Page and running into trouble with the footer element.

Even though I've set the width to 100%, when I preview it in the browser, there seems to be a small border of pixels remaining on the left, right, and bottom.

Here's the CSS for the footer:

footer {
width: 100%;
background: white;
height: 100px;
margin-top: 100px;

}

No matter what adjustments I make, such as adding 'left: 0px;' 'bottom: 0px;' or 'right:0px;', nothing seems to work.

Any suggestions on how to fix this issue?

If my explanation wasn't clear enough, you can refer to the image linked below:

Answer №1

It seems like you forgot to reset the padding and margin values for the body element. Browsers typically apply default CSS rules to the body, which may include some padding and margins.

To fix this, add the following code to your CSS file:

body { margin: 0; padding: 0; }

Answer №2

There appears to be a fixed width or some margin and padding on the parent element (potentially <body> or another <div>).

By using width:100%;, your footer will take up all the available space provided by the parent element. For instance, if the parent has a width of 700px, then your footer will also inherit this width.

Answer №3

It appears that the margin and padding you are seeing belong to the body element, not the footer itself. To address this, consider including the following code in your body's CSS section:

body
{
  margin:0;
  padding:0;
}

Furthermore, be sure to include these same properties in your footer's CSS section to prevent it from inheriting any unwanted styles from other elements.

Answer №4

It seems like there is an issue with the merging/padding here. You could try resetting the body padding and footer margin to ensure they cover the full 100% width.

body {
    margin: 0px;
    padding: 0px;
}

footer {
    margin: 0px;
}

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

Fluid container and confined container

Can someone explain the guidelines for when to use container versus container fluid in web development? What are some best practices and common pitfalls to avoid when using these two options? I would appreciate a clear explanation of the differences betwe ...

Updating divs automatically using Ajax without refreshing the page is not functioning as intended

I'm having trouble understanding why this isn't functioning properly. My goal is to have the data from load.php displayed in the div sample. However, if the code is updated (for example, when pulling information from a database), I want only the ...

The jQuery each() method only targets the first element in the selection

Hello, I'm facing an issue where I am trying to loop through some elements and delete their parent div holder if it is found to be empty. The jQuery code I am using is as follows, but for some reason, it only removes the first matched element and none ...

Transform your current website layout from a fixed 960-grid system with 12 columns into a fluid and

As a newcomer to web development, I have successfully created my portfolio website. I initially set the body width to 1600px because that matched the size of my banner background in Photoshop. I'm using a 960gs 12-column grid system, but when I view t ...

Learn how to integrate Bootstrap with Vue.js TreeView in this tutorial

If you're looking to create a treeview using Vue.js, the code structure would resemble something like this: HTML: <!-- item template --> <script type="text/x-template" id="item-template"> <li> <div ...

Having trouble identifying the source of the margin-right styling being used

I'm facing a perplexing issue with the CSS for my sidebar (#primary) on my website. Even though I haven't specified any margin for the sidebar, it is somehow getting a margin-right of 605px. In trying to solve this, I experimented with relative ...

two sections lined up beside each other

Currently, I have two sections positioned on separate lines. Each section consists of multiple lines of text, and I am looking to align them next to each other with a 10px margin between them. Would appreciate any assistance in achieving this setup. Thank ...

Steps to insert a new row for a grid item using material-ui

When it comes to breaking a line of grid item like this, the image shown below illustrates how the rest space of the grid should be empty. https://i.stack.imgur.com/pvSwo.png <Grid container spacing={3} <Grid item xs={12}> "Grid Item xs ...

Eliminate gaps created by grid rows by incorporating elements of varying heights

This is the standard format of the page: * { margin: 0; padding: 0; } img { width: 100%; float: left; } #grid { display: grid; grid-template-columns: repeat(3, 1fr); } #test-one { grid-column-start: 1; grid-column-end: 2; width: 100 ...

Adjust speed on various HTML5 video players

I'm looking to slow down all the HTML5 video players on my page to 0.5x speed. Currently, I have a JavaScript snippet that only affects one video player at a time. <script type="text/javascript"> /* play video twice as fast */ document.quer ...

Centering a form on a webpage with Bootstrap: A step-by-step guide

Utilizing twitter-bootstrap for styling, I have implemented a login form and am attempting to center it on the page. Most suggestions on stackoverflow advise placing elements inside the container class, which is what I have done. The requirement is for t ...

Unable to trigger click event

I apologize for asking the same question again, but I'm really struggling with this seemingly easy (or difficult?) code problem. Despite trying out Rory McCrossan's solution from here, it still doesn't seem to work for me. Can someone please ...

All of the jstree add-ons are not working as expected

I've encountered a frustrating issue that I can't seem to find any documentation on. While I'm still relatively new to jQuery, my understanding is growing, but I'm completely unfamiliar with the jsTree plugin. The problem I'm faci ...

Load Bootstrap CSS file externally on a website dynamically

Although my knowledge of JavaScript is limited, I am the recipient of a small web application from a friend that is being utilized by multiple companies. As each company requires specific modifications in the appearance and CSS of certain webpages, it can ...

exploring the seamless transfer of values between Thymeleaf and Spring controllers, and vice versa

As a newcomer to thymeleaf, I'm seeking guidance on how values are passed between the thymeleaf HTML and Spring controllers. Could someone please recommend some helpful tutorials for thymeleaf-spring-mvc? In the following example, I would like to und ...

Troubleshooting a PHP form problem related to MySQL

As a beginner, I am attempting to develop a project management web application. Despite my best efforts, I have not been able to find similar resources... The project involves selecting and loading x type of projects through AJAX. Each type of project re ...

Issues with Angular-Trix compatibility with Internet Explorer 10

I am currently using the Angular-trix rich text editor, which is functioning perfectly in all browsers including IE 11. However, I am encountering issues with it not working in IE10 or earlier versions. An error message that keeps appearing states: Una ...

React and Mui are experiencing a peculiar issue where a background is mysteriously missing from a component in a specific location

Exploring React 16 and functional components with hooks Discussing Mui 4 framework Adding a background pattern to multiple login pages seems simple, right? Here is an example of a login page component: return ( <Box width={1} height={1}> ...

What is the most effective way to enlarge an HTML table in the center?

Currently, I am dynamically generating an HTML table using a repeater. The table consists of four columns that I populate with company data. My goal is to enable users to click on a row and have another row appear below it, containing a Google map and addi ...

How to Extract Text Content Excluding the Wrapping Tag from an Element Using JSoup

How can I take the text 'Some random text' and enclose it within a span tag? For example, if I have the following element: <div> Some random text 1 <a href="some_url">Go to Link</a> </div> <div> <spa ...