Containing more than a full page of information, the footer stays fixed at the bottom of the screen, even as the user scrolls to

As I work on developing my artist website to showcase my music, I have encountered an issue with the footer placement. My goal is seemingly simple - I want a footer that always sits at the bottom of the site, just under the content/body section. There should be no white space on the left, right, or bottom. Ideally, when there is minimal content on the page, the footer will still hug the bottom of the screen. However, the challenge arises when the content extends beyond one page; instead of pushing the footer down, it remains fixed in its position, causing overlap issues with other content.

I've spent days searching through various sites and forums trying different solutions. While I've made progress by adjusting margins and positioning, this particular problem persists. Any assistance would be greatly appreciated. (For reference, I am using a Wordpress Twenty-Twelve Child Theme)

View Undesired Footer Image

View Desired Footer Image

My current thoughts on potential causes are:

  1. There might be code forcing the footer to stick to the bottom of the screen, irrespective of content amount, possibly utilizing min-height:100%. However, adding or removing this line yields no change.

  2. There could be a hierarchy issue within the HTML structure? The Twenty-Twelve theme uses #masthead, #page, #main, and #colophon elements. Some sources suggest placing the footer outside the main wrapper, which I've done without success.

  3. The problem may not lie in the footer itself but possibly in surrounding containers like #main requiring specific positioning adjustments (e.g., setting position:relative), yet this approach hasn't resolved the issue.

Provided below is the entire HTML snippet:

<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header" role="banner">

<nav id="site-navigation" class="main-navigation" role="navigation">
<button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav><!-- #site-navigation -->
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php header_image(); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
<?php endif; ?>

</header><!-- #masthead -->

<div id="main" class="wrapper">

</div><!-- #page -->
</div><!-- #main .wrapper -->
<footer id="colophon" role="contentinfo">
</footer><!-- #colophon -->
<?php wp_footer(); ?>

</body>
</html>

The CSS styling for the footer is as follows:

footer {
background:url(http://kjel.ca/wp-content/uploads/2014/12/footer-img.jpeg) repeat-x bottom center;
height:100%;
width:100%;
position:absolute;
margin:0px;
padding:0px;
bottom:0px;
min-width:100%; 
}

Despite attempting commonly recommended solutions like Ryan Fait's sticky footer, I have struggled to achieve the desired outcome. As someone with limited coding expertise seeking cost-effective options, any guidance on rectifying footer placement woes would be immensely valuable. Visit my site at www.kjel.ca for further context. Thank you!

Answer №1

Give this a shot :

#colophon {
    background:url(http://kjel.ca/wp-content/uploads/2014/12/footer-img.jpeg) repeat-x bottom center;
    height:100%;
    width:100%;
    position:absolute;
    margin:0px;
    padding:0px;
    bottom:0px;
    min-width:100%; 
}

instead of

footer {
    background:url(http://kjel.ca/wp-content/uploads/2014/12/footer-img.jpeg) repeat-x bottom center;
    height:100%;
    width:100%;
    position:absolute;
    margin:0px;
    padding:0px;
    bottom:0px;
    min-width:100%; 
}

Answer №2

Exciting update, I've successfully resolved the code issue. I revamped the code for #colophon. The original code looked like this:

#colophon {
    background:url(http://kjel.ca/wp-content/uploads/2014/12/footer-img.jpeg) repeat-x bottom center;
    height:80%;
    width:100%;
    position:absolute;
    margin:0;
    padding:0;
    bottom:0;
    min-width:100%;
    min-height:1%; 
}

I made some improvements to it and now it looks like this:

#colophon {
    background: url("http://kjel.ca/wp-content/uploads/2014/12/footer-img-2.jpeg") repeat-x scroll center bottom transparent;
    height: 100%;
    position: absolute;
    width: 100%;
    background-size: 100% 448px;
}

The issue seemed to stem from the value of bottom: 0; which pushed the footer below the content with a right margin. To resolve this, I added the following code:

footer[role="contentinfo"] {
    line-height: 2;
    max-width: 100%;
    margin-top: 0;
    padding: 0px 0px;
}

Many thanks for your assistance everyone.

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

Troubleshooting: Images not displaying properly in React due to Webpack configuration bottleneck,

I am facing an issue with loading images in my React application. Some images are set up in the CSS file like this: background-image: url('/../img/logo.png'); On the other hand, I would like to use images inside React components using the img ...

Is it feasible to customize the icon for the expand/collapse button in the header of jqGrid?

To begin, let me provide some context. In my view, I have 2 or more grids (jqgrid) and I aim to insert an "X" into the expand/collapse button. After several attempts, I successfully added the "X" icon to all grids using this code: .ui-icon-circle-trian ...

Steps for embedding a webpage within a div element

I am facing an issue while trying to load a web page within a div using an ajax call. Unfortunately, it's not working as expected and displaying the following error message: jquery.min.js:2 [Deprecation] Synchronous XMLHttpRequest on the main thread ...

Troubleshooting a problem with the Bootstrap dropdown menu

Can anyone assist with an issue regarding Bootstrap 4.4.1? I am facing a problem where two consecutive dropdown links+menus are not displaying correctly. The second dropdown menu is showing the content of the previous link instead of its own, even though t ...

Load a page from a different domain using uframe

Looking for a solution to successfully load an external URI using uFrame. Currently encountering an "Access Denied" issue when attempting to do so on Firefox. Any suggestions? ...

Developing for Android: Extracting information from WordPress

I'm currently working on developing an android application that will showcase various school events, including the event title and a corresponding image. All I require for the successful functioning of the app is to fetch data (the event title as a s ...

I am encountering a continuous css ParserError while trying to compile my react project

I'm having trouble with the compilation of my React project. While everything runs smoothly with npm start, I encounter an error during compilation: npm run build <a href="/cdn-cgi/l/email-protection" class="__cf_ema ...

Choose an input that is not grouped with the rest

I am facing an issue where I need to group these three inputs together as one continuous form. However, there seems to be a problem with the select input not aligning correctly with the rest of the form. Is there something that I might be doing wrong? & ...

Locate the nearest date (using JavaScript)

Searching for the nearest date from an XML file. <?xml version="1.0" encoding="UTF-8"?> <schedule> <layout fromdt="2014-01-01 00:00:00" todt="2014-01-01 05:30:00"/> <layout fromdt="2014-02-01 00:00:00" todt="2014-01-01 05 ...

What is the process for choosing a particular input element based on its size and type?

Among my pair of sets containing input type=text elements, each group is uniquely styled through CSS. In the first set, the length adjusts based on CSS using the width property. Conversely, in the second set, the size attribute determines the length of the ...

Employing plain Javascript (without the use of jQuery) to concatenate information from two JSON strings - encountering an error due to the absence of

Having a JSON stringified form data like this: {"name":"jack miller", "address":"123 main st"} I aimed to append more records but encountered an error saying "append is not a function." The desired outcome is to have both sets of records in this format: ...

Can someone show me how to code a function that transforms my paragraph into an image when I hover over it?

< p id="p1" onmouseover="this.style.color='transparent';flipPara()"> < p id="p2" onmouseover="spookyPara()"> function spookyPara() { document.getElementById("p1").attribute = "All_Images/ghost.png"; } I currently have this code sn ...

Tips on making Material-UI Drawer compress other content when it is open

Seeking assistance from those familiar with CSS and Material UI! I'm currently working on implementing a Material UI Drawer component that doesn't just slide out over the top of the page content, but actually causes the page content to adjust aro ...

Display a personalized message at the WooCommerce checkout depending on the customer's shipping destination

I am currently using a code snippet to display a personalized message based on the country selected: add_action( 'woocommerce_before_checkout_billing_form', 'display_shipping_notice' ); function display_shipping_notice() { ech ...

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 ...

What is the best way to implement lazy loading of images that have not been downloaded in a JavaFX WebView?

Currently, I am in the process of developing an email client application using JavaFX WebView to showcase email HTML files. In order to enhance its responsiveness and speed, my goal is to display inline images in emails as they are downloaded locally. Duri ...

Activate a switch in a single table after its information has been transferred to a different table

I have a dilemma involving two tables - one displaying a list of items and the other serving as an empty favorites table. Users can select items from the first table and click 'Add' to move them to the favorites table. Once added, the 'Add& ...

Alter the row's color using the selection feature in the module

Is there a way to change the color of a row when a specific property has a certain value? I found a solution for this issue on Stack Overflow, which can be viewed here: How to color row on specific value in angular-ui-grid? Instead of changing the backgro ...

What is the best way to eliminate the margin on the <v-textarea> component in Vuetify?

My textarea seems to have a top margin that I can't get rid of. Here is my code: <v-flex d-flex xs12> <v-textarea v-model="test" outline type="text" color="primary" v-valida ...

Can you show me the procedure for retrieving a particular element with selenium? (Page Source provided)

Disclaimer: I must admit that my knowledge of HTML and CSS is minimal, so please bear with me! Hello everyone, I am attempting to utilize selenium[Java] to browse a website and retrieve a file. While I managed to successfully get past the login page, I fi ...