Stationary element against backdrop

I am attempting to create a footer that subtly emerges from behind the div element above it.

One example is the layout of the Pitchfork website, where the footer sits at the bottom of the page.

In my CSS attempt:

#footer {
    overflow: hidden;
}
#footer .text {
    position: fixed;
}

Alternatively, I could make it fixed and place it at the bottom of the page by setting the total height of the website. However, this approach seems overly complex.

Does anyone have ideas or simple tutorials on how to achieve this effect?

Answer №1

Give this a shot:

#footer {
   position:fixed;
   left:0px;
   bottom:0px;
   height:30px;
   width:100%;
   background:#999;
}

/* For Internet Explorer 6 */
* html #footer {
   position:absolute;
   top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}

Answer №2

Apply the following CSS style to the footer section:

footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: -1;
  height: 150px; /* adjust as necessary */
}

This will keep the footer at the bottom left corner and layer it behind other elements (z-index -1).

Additionally, make sure to add enough margin-bottom to the last element in the document flow equal to the height of the footer. This allows content to scroll above the footer, for example, 150px in this case.

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

Using force-directed layout to access and retrieve specific data from external or internal data sources

Just starting out with d3js and currently working on modifying the Force directed layout found at http://bl.ocks.org/mbostock/1153292 I have managed to make it so that when I hover over the node circles, the corresponding source value filenames should app ...

I would like to create a vertical line similar to the ones seen on Twitter

I'm currently working on a project to create a social media platform similar to Twitter. One thing I'm trying to accomplish is to draw a vertical line between two images, like the one in this tweet from PewDiePie, and have it centered between two ...

Why does my Bootstrap button make my modal window blink when clicked?

Here is the code snippet for my button: Click Me Check out this script for a model window: $("#check_all").click(function(event) { if(this.checked){ $(".test").each(function() { this.checked=true; }); } el ...

Tips for incorporating additional filter criteria into a jquery script

I am currently utilizing a jQuery script to filter data based on date periods. However, I now need to include an additional filtering criteria for the "POSITION" column. Since I lack expertise in jQuery, I would rather accomplish this using plain vanilla J ...

Struggling to implement the UI router into my Angular Framework

I've been working on a framework that is supposed to be router agnostic. While I've managed to make it work with ngRoute, I just can't seem to get it functioning with UI Router. Here's a snippet of the main app module: (function () { ...

The desired outcome is not displayed following the Ajax post request

I have created an app that utilizes asynchronous AJAX requests to enable seamless chat functionality without refreshing the page. However, I'm facing an issue where the messages are not being displayed. When I inspect the network tab and navigate to t ...

Switch between showing and hiding a div by clicking on the panel header and changing the symbol from + to

I need assistance with a panel feature on my website. The panel should expand when the "+" symbol is clicked, displaying the panel body, and the "+" symbol should change to "-" indicating it can be collapsed by clicking it again. There is a slight twist t ...

Utilize PHP to input and swap information within SQL databases

TABLE1: table1ID | studentnum | lname | fname | mname TABLE2: table2ID | studentnum | remarks | others //FORM 1 CODE $sql = "INSERT INTO TABLE1 (studentnum, lname, fname, mname) VALUES ('$studentnum','$lname','$fname','$ ...

When a selection is made, the tab changes to a new URL. However, what happens if the tab is closed during the next selection change?

Is there a way for me to detect if the user has closed the browser tab that I opened and redirected to a URL? Here is the code I have so far. It checks if the user changes the value of a select dropdown, then it verifies whether the browser window was alr ...

What is the best way to create a line break at the maximum width point?

I am currently working on a code that dynamically receives variables and concatenates them with an underscore: var text = product + "_" + someOtherInfo; After combining the variables, I need to display this text inside a div element. div { max-width ...

Hover effect alters background color

I've successfully created a box around text, but now I want it to change color when hovered over. However, I'm facing difficulty in achieving this effect. An image has also been attached for reference. Please review the image and locate the socia ...

Extract the chosen option from a dropdown menu, and then transfer it to another dropdown menu with a new corresponding value

Below is a select box I currently have: <td align="center"> <select id="selectW" name="type" onChange="this.form.submit()"> <option value="select...">select</option> <option value=" ...

What is the best way to add content to a TextArea generated by the html helper in MVC 3?

I am attempting to retrieve a List collection of comments from the View using Razor and Microsoft's HTML helper for TextArea (@Html.TextAreaFor). While I can populate individual comments easily, I am unsure how to add the ENTIRE list collection of com ...

As two divs glide across the screen, the top div remains hidden from view

To enhance our user experience, we are tasked with creating a captivating screen saver featuring 3 images. The bottom image will remain fixed in its position. The middle image should move across the screen. Lastly, the top image will move at a faster ...

Display issues with React styled components preventing proper rendering on the screen

Having issues with my style components displaying in a web application I'm developing using React and Ruby on Rails. Everything was working fine until I added a third style component, now even after removing it, nothing shows up on the screen after ru ...

Can links be integrated into Bootstrap 4 nav-pills tab-panel from another webpage?

I've managed to set up a service page with bootstrap 4's pills .nav-pills navigation, and it's functioning quite well. However, my current challenge involves allowing users to click on a link from the home page that will direct them to a spe ...

Exploring the power of positive lookahead in CSS styling

When working with Perl regex, I understand how positive lookahead works - such as q(?=u) matching a q that is followed by a u without including the u in the match. Now, I am interested in finding something similar in CSS: specifically, I am looking to sele ...

Aptana throws a fit over a script that's as empty as

Within Aptana, I am encountering an issue with the following line of code: <script type="text/javascript" charset="utf-8" src="js/jquery-1.7.2.js"></script> Alternatively, it could be written as: <script type="text/javascript" charset="ut ...

Using a <div> to contain <mat-card> in Angular Material

Can you achieve the following: Show components with specified width in a row instead of the usual column layout Enclose the cards within another defined container I've been attempting to accomplish this but without success so far.... While materia ...

How can a div be positioned outside of an overflow scroll without resorting to absolute positioning?

I am currently designing a blog theme and I would like to include a small box that displays the post date offset to the left of each post, similar to this mockup: My issue arises because the post container has overflow scrolling enabled, making it difficu ...