Is there a different option for determining the space between the main body and footer instead of using a

After creating a footer that sticks to the bottom of my webpage, I noticed that it lines up right after the last image with no spacing in between. To add some space between the final image and the footer, I considered using a percentage-based margin. However, setting a margin-bottom:180% felt like a messy solution that could cause issues when resizing the window. Here is a simplified version of my code:

<body>
<div id='wrapper'>
<section class='gallery-set'>
<div class='wrap'>
    <img class='tilesetsmall' src ='images/sample.jpg'/>
  <div class='ontop'><p class='example-text'>Overlay Test text </p></div>
</div>
</section>
</div>
<div id="footer">
</div>
</body>

My aim now is to introduce some spacing between the footer and the rest of the content.

Answer №1

For a more flexible approach, consider using em instead of px if you prefer dynamic design.

margin-bottom: 30px;
margin-bottom: 5em;

Learn more about CSS units at this informative link: http://www.w3schools.com/cssref/css_units.asp

1em is equivalent to the current font size. For example, 2em would be twice the size of the current font.
If an element is displayed with a font size of 12 pt, then '2em' would be 24 pt. The 'em' unit in CSS adjusts automatically according to the reader's chosen font size.

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

Ensure the div has a scrolling feature activated when the content surpasses the height limit

I am attempting to make the middle div #content scroll when its content exceeds the available height (calculated as innerWidth - header height - footer height). However, rather than scrolling, the div has a scrollbar that is unresponsive, and the entire p ...

The navigation bar isn't turning into a hamburger menu - using bootstrap and Flask

My mobile responsive navbar is not rendering correctly on smaller screens. Check it out here: I am using Bootstrap Material Design with Flask and this is the code snippet for my nav-bar: <!-- Navbar --> <nav class="navbar navbar-expand-lg na ...

Differences between CSS Display None and Collapse

Can you explain the distinction between the following two options? display: none; visibility: hidden; I always thought that visibility: collapse was only applicable to tables. Am I mistaken? ...

I seem to be having trouble with the Clearfix - the elements at the bottom are overflowing the container

Hey there! I'm having some trouble with my website, specifically at the bottom where the letters and hr line are overflowing the container. I thought about using a clearfix, but it doesn't seem to be working as expected. I even tried adding an ov ...

The multiple-choice selection tool is not displaying any choices

I am having an issue with my ng-repeat code in conjunction with the jquery multiple-select plugin. Despite using this plugin for a multiple select functionality, the options generated by ng-repeat are not visible. Below is the code snippet in question: & ...

iPhone 3GS and 4 not expanding DIVs by 100%

I've been encountering a significant issue with a div that's set to 100%. It displays properly on desktop screens, but on iPhones, there appears to be a gap on the right side. I've attempted to use the following CSS: body { min-width:980p ...

Creating a virtual roulette wheel with JavaScript

I'm currently working on creating a roulette wheel using JavaScript. While researching, I came across this example: , but I wasn't satisfied with the aesthetics. Considering that my roulette will only have a few options, I was thinking of using ...

The intricate procedure behind applying a blur effect using CSS3 filters

MDN documentation explains that the filter blur function applies a Gaussian blur to the input image. After comparing it with OpenCV's GaussianBlur, I noticed that their effects are not identical. I am looking to achieve a similar effect using CSS3&ap ...

The fields in the row of the Rails form_tag are overly spacious

My login form in Rails 4 with Bootstrap 3 is giving me trouble. It doesn't format well on any device, especially smaller screens where it becomes unusable. I suspect the huge right margin of the rows is to blame, but I can't figure out the root c ...

Height of cells is often overlooked in webkit browsers

When adjusting tbody and thead heights, I noticed that webkit does not behave like other browsers. I've set the height of td. Here is an example of what I am referring to: link The question at hand is - which browser is displaying correctly? And ho ...

Using CSS and jQuery to Enhance Page Transitions

Seeking assistance with creating a unique page transition similar to this one: Basing the animation on my own design concept found here: Current experiment can be viewed at: https://jsfiddle.net/f7xpe0fo/1/ The animation does not align with my design vi ...

What is the equivalent of a very deep selector in TailwindCSS?

When working with the v-deep selector to customize the appearance of tiptap, a rich text editor, accessing the .ProseMirror class in SCSS would look like this: editor-content { // ... styles &::v-deep(.ProseMirror) { // ... styles } } ...

I'm wondering if anyone has any insights as to why the CSS rule `body{ overflow: auto;}` is not functioning properly for me. Despite my attempts of adding a class to the body tag and

I am facing an issue where adding body tags to my code in Visual Studio code does not yield the desired results. Interestingly, it doesn't seem to be a syntax error in CSS. body{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI&apo ...

ScrollReveal.js won't function as intended

https://i.stack.imgur.com/SOQEk.png Looking to utilize the popular ScrollReveal.js created by Julian Lloyd (ScrollReveal) Despite following instructions from various sources, the script is not producing the intended effect. Steps taken to make it work: ...

"Optimize Magellan Sidebar for Mobile Devices by Relocating it to the Bottom of the Page

After spending a week working with Foundation 5 framework, I'm curious if there is a straightforward way to make my magellan sidebar shift to the bottom of the page when viewed on mobile or tablets. <div data-magellan-expedition="fixed"> <di ...

The JSP page is unable to locate or access relative resources such as CSS stylesheets and images

I'm struggling to create a basic web page using JSP. The issue I'm facing is that no resources, such as images or CSS, are being found regardless of the URL I use. Here is my simple JSP code: <%@ page language="java" contentType="text/html; ...

CSS3 Internet Explorer 6 problem

In Firefox, the following code works fine as I am using CSS3 to create rounded borders. Can someone please advise on what changes are needed to achieve the same result in IE6? Here is the code: <html> <head> <style type="text/css"> bac ...

Grab cell information from a dynamic table using Ruby and Selenium

I am attempting to retrieve a property of cells within a table. <table id="m-103" class="m-row" cellspacing="0"> <a name="2"></a> <table id="m-108" class="m-row " cellspacing="0"> <a name="3"></a> <table id="m-191" ...

What is the best way to showcase varying colors in HTML content pulled from a database?

I have a MySQL database with 15 or more rows that I want to retrieve and display in alternating colors. For the first row: <tr><td height="30" bgcolor="#F5F5F5">....</td></tr> For the second row: <td height="30" align="center" ...

What is the best way to enable CSS IntelliSense for a Nuxt project?

Currently, I am undertaking a project using Nuxt.js and have set up a Docker image to manage all aspects of it. Additionally, I am looking to integrate MDBVue as a CSS library into my project. After some research, I learned that in order to utilize this li ...