Ways to Ensure the Footer Stays Beneath Your Image Gallery

After successfully keeping the footer at the bottom of other pages on my website, I'm facing a challenge with my photo gallery page. The footer stubbornly sits in the middle of the page. :(

This is the HTML code for that particular page:

html {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  color: #FF6347;
  font-family: 'Ceviche One', cursive;
  font-size: 2em;
  margin: 0;
  padding: 0;
  height: 100%;
}
#wrapper {
  margin: 0;
  padding: 0;
  min-height: 100%;
  position:relative;
}
#footer {
  background-color: #E9967A;
  color: black;
  margin: 0;
  padding: 0 30px;
  height: 50px;
  width: 100%;
  position: absolute;
  bottom:0;
}
#gallery {
  margin: 0;
  padding: 0;
  list-style: none;
}
#gallery li {
  float: left;
  height: auto;
  width: 45%;
  margin: 2.5%;
  background-color: #FFEBCD;
  color: #FF6347;
  }
<body>
    <div id="wrapper">
        <p class="sectionheader">Beautiful Places in Tyria</p>
        <ul id="gallery">
           <li><p class="captionheader">Garden of Dawn</p>
           <a href="img/treehouse Garden of Dawn.jpg">
             <img src="img/treehouse Garden of Dawn.jpg" alt="">
           </a>
           </li>
           <li><p class="captionheader">The Planetarium</p>
           <a href="img/treehouse The Planetarium.jpg">
             <img src="img/treehouse The Planetarium.jpg" alt="">
           </a>
           </li>
           <li><p class="captionheader">Wizard's Fief</p>
           <a href="img/treehouse Wizard's Fief.jpg">
             <img src="img/treehouse Wizard's Fief.jpg" alt="">
           </a></li>
           <li><p class="captionheader">Black Citadel Statues</p>
           <a href="img/treehouse Black Citadel Statues.jpg">
             <img src="img/treehouse Black Citadel Statues.jpg" alt="">
           </a></li>
           <li><p class="captionheader">Shrine of the Six</p>
           <a href="img/treehouse Shrine of the Six.jpg">
             <img src="img/treehouse Shrine of the Six.jpg" alt="">
           </a></li>
         </ul>

       <div id="footer">
        <a href="http://facebook.com/rejisama">
          <img src="img/facebook-wrap.png" alt="Facebook logo" class="social-icon">
        </a>
        <a href="http://twitter.com/nogoodreji">
           <img src="img/twitter-wrap.png" alt="Twitter logo" class="social-icon">
        </a>
        <p>&copy; 2016 All rights reserved.</p>
       </div>
    </div>
  </body>

Answer №1

html {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  color: #FF6347;
  font-family: 'Ceviche One', cursive;
  font-size: 2em;
  margin: 0;
  padding: 0;
}
.content{
  width:100%;
  display:block;
  }
#wrapper {
  width: 100%;
  margin: 0;
  padding: 0;
  display: block;
}
.content{
  display: block;
}
#footer {
  background-color: #E9967A;
  color: black;
  margin: 0;
  padding: 0 30px;
  height: 50px;
  width: 100%;
  display:block;
  
}
#gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;

}
#gallery li {
  display: inline-block;
  height: auto;
  width: 40%;
  margin: 2.5%;
  background-color: #FFEBCD;
  color: #FF6347;
  }
<body>
    <div id="wrapper">
    <div class="content">
        <p class="sectionheader">Beautiful Locations in Tyria</p>
        <ul id="gallery">
           <li><p class="captionheader">Garden of Dawn</p>
           <a href="img/treehouse Garden of Dawn.jpg">
             <img src="img/treehouse Garden of Dawn.jpg" alt="">
           </a>
           </li>
           <li><p class="captionheader">The Planetarium</p>
           <a href="img/treehouse The Planetarium.jpg">
             <img src="img/treehouse The Planetarium.jpg" alt="">
           </a>
           </li>
           <li><p class="captionheader">Wizard's Fief</p>
           <a href="img/treehouse Wizard's Fief.jpg">
             <img src="img/treehouse Wizard's Fief.jpg" alt="">
           </a></li>
           <li><p class="captionheader">Black Citadel Statues</p>
           <a href="img/treehouse Black Citadel Statues.jpg">
             <img src="img/treehouse Black Citadel Statues.jpg" alt="">
           </a></li>
           <li><p class="captionheader">Shrine of the Six</p>
           <a href="img/treehouse Shrine of the Six.jpg">
             <img src="img/treehouse Shrine of the Six.jpg" alt="">
           </a></li>
         </ul>
       </div>
       </div>
       <div id="footer">
        <a href="http://facebook.com/rejisama">
          <img src="img/facebook-wrap.png" alt="Facebook logo" class="social-icon">
        </a>
        <a href="http://twitter.com/nogoodreji">
           <img src="img/twitter-wrap.png" alt="Twitter logo" class="social-icon">
        </a>
        <p>&copy; 2016 All rights reserved.</p>
       </div>
    
   
  </body>

Answer №2

After experimenting, I discovered that setting the ul#gallery to have a style of display:inline-block; can solve the issue of having zero height in the gallery and also push the footer to the bottom.

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

Retrieve the screen width using a JavaScript function and apply it as a percentage

I find myself needing to adjust the size of table elements based on the width of the screen. While I am not well-versed in javascript or html, resolving this issue is crucial. Unfortunately, I did not create the original asp page and have limited ability t ...

Can the tab button be used to move to the next field?

Is it possible to navigate to the next field by pressing the tab button? If so, how can we achieve this? Currently, I am utilizing Bootstrap classes col-md-6. Thank you! <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4. ...

Tips for creating an animated effect on the active tab when it switches

Currently, I have a tab list containing li items. When an item is active, the li item has rounded corners and a box shadow effect. My goal is to add an animation that shows the active pill moving to its next position when it changes, but I am unsure of how ...

Retrieving information received from an XML HTTP request in node.js

Currently, I am transmitting text data from a textbox to a node.js express server using XMLHttpRequest: var text = document.getElementById("textBox").value; console.log(text); var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Fire ...

Using JSON parsing to extract an integer as the key in JavaScript

I've been searching for almost 2 hours now, but I can't seem to find anyone using an integer as the key in their json object. The structure of my json object is as follows: {"342227492064425": {"added":"2020-10-04T23: ...

Craft an engaging and dynamic Image map with SVG technology to elevate responsiveness and interactivity

I'm currently working on a website and I need to create two clickable sections on the home page. Each section will lead to a different specialization of the company. To achieve this, I decided to use a square image split into two right-angled triangle ...

The vanishing act: Semantic UI menu disappears when you click

My objective is to create a persistent left-side menu using Semantic-UI. I want to implement two different states for the menu - one with text for each item and another with an image for each item. However, I am facing some challenges that have me complete ...

Linked Dropdownlists Connected to a Single Dropdownlist

I am struggling to find the best way to phrase my question, but I need some help. I want to connect three dropdown lists together in a specific way. Dropdown list 2 and 3 should be disabled so the user cannot interact with them, while dropdown list 1 remai ...

What is the best way to incorporate an image as an input group addon without any surrounding padding or margin?

Hello, I am currently working on integrating a captcha image into a Bootstrap 4 form as an input group item. It is functioning correctly, but there is an issue with a border around the image causing the input field to appear larger than the others. Below i ...

Issue with parallax scroll feature on Mobile Safari not functioning as expected

I created a JavaScript code for parallax scrolling on an image at the top of a webpage. The code functions perfectly on Chrome, Firefox, Internet Explorer, Opera, and Safari on desktop. However, when I tested it on Safari on my iPad, the parallax effect wa ...

Make sure to close all your tags properly in PHP

Within my <textarea>, I am giving users the ability to submit content. The specific tags I want to allow include <b>, <i>,<blockquote>, and <del>. In order to prevent any unclosed tags since this content will be displayed on t ...

The removal of the div element doesn't seem to be functioning properly

I am struggling with adding and removing div elements using jQuery. While adding a div element is working fine, I am facing issues with removing a div element. Here is the implementation: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...

How to use jQuery Animate to create a step-by-step animation with image sprites?

I'm working on creating an image sprite using jQuery and I'm curious if it's feasible to animate it in steps rather than a linear motion. I initially tried using CSS3 animations, but since IE9 is a requirement, the animations didn't wor ...

Adjusting the height of a CSS div to be 0 while also modifying the

I have encountered a unique dilemma <div class="parent"> <p>stuff stuff stuff</p> </div> Using CSS, I set the width and height of parent = 0; because I intend to modify it when a button is clicked. However, for this purpose, I ...

overlay the text at the top of a div

Looking to create an overlapping effect with text in a div, similar to the example shown in the image. I am currently utilizing Bootstrap, but open to using CSS as well. However, I need the text to go slightly underneath the overlapping element. View the ...

Learn how to easily incorporate a drop-down list into the material-UI Search component within the navbar to enhance the search results

I integrated a Material UI search bar into my React app's navbar following the instructions from the official documentation on MUI. However, the article does not provide any guidance on how to add a dropdown list when selecting the search input field. ...

Retrieve all information contained within the HTML tags <div align="center"></div> using Java programming

I am new to Java and feeling a bit overwhelmed since I have no experience with it. With Selenium, I was able to download the HTML of a page and store it in a string. Now, my goal is to extract all the data between <div> tags and populate an array wit ...

Tips for seamlessly integrating full-size images into the slider?

I'm a beginner when it comes to CSS and I am having trouble fitting two images inside my first slider. My goal is to display the full images within the slider, but the width of the images exceeds that of the slider. Below is the CSS code for the slid ...

Streamlining all icons to a single downward rotation

I am currently managing a large table of "auditpoints", some of which are designated as "automated". When an auditpoint is automated, it is marked with a gear icon in the row. However, each row also receives two other icons: a pencil and a toggle button. W ...

The issue persists with the JavaScript window.location script constantly refreshing

I am currently working on a small web application where I want to update 2 parameters in the URL using Javascript. However, every time I use "window.location.search = 'scene.html?name=' + person + '&scene=' + readCookie("scene");", ...