Design a footer using HTML specifically for the bottom section of the document, rather than the

I'm facing an issue on a website where the footer is not sticking to the bottom of the document body in HTML. The problem arises when I try to place the footer at the end of the content, leading to white space after it. If I use fixed positioning for the footer in CSS, it sticks to the bottom of the user's view rather than the document. Here's an illustration of the problem: https://i.sstatic.net/1ap3E.png. When using fixed positioning, the result looks like this: https://i.sstatic.net/fey2I.png. To provide more context, here's another image showing the footer attached to the bottom of the user's view: https://i.sstatic.net/oNpUB.png. My goal is to attach the footer to the end of the document after all contents without relying on the body or user view.

/*End FontFamily*/
/*===========================================================================*/
/*General style*/
body{
    font-family: Vazirmatn;
}
.shadow{
 box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;   
}
.cardbox{
    background-color: white;
    margin-bottom: 16px;
}
hr{
    color: lightgray;
}
a{
    text-decoration: none;
}
.pull-right {
    float: right;
}
.pull-left {
    float: left;
}
.green{
    color: green;
}
red{
    color: red;
}
.gray{
    color: darkgray;
}
.darkgreen{
    color: darkgreen;
}

... (CSS styling continues)
<!DOCTYPE html>
<html dir="rtl">
    
    <head>
        <!-- Head section content here -->
    </head>
    <body style="background-color: aliceblue">

        <!-- Main body content starts here -->

      
              <!-- Place your HTML content and structure here -->

        
        <!-- Footer section begins -->

        <footer>
            <div class="footer cardbox shadow">
                Your custom footer content goes here.
            </div>
        </footer>

    </body>

</html>

Answer №1

Are you satisfied with this solution?

I implemented the layout using css grid. You can find the CSS rules at the beginning of the document. To understand how it works, refer to: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout

body {
  font-family: Vazirmatn;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.main_menu {
  grid-row: 1;
}
.main_content {
  grid-row: 2;
}
.footer {
  grid-row: 3;
}
/* CSS Styles */
.shadow {
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}
.cardbox {
  background-color: white;
  margin-bottom: 16px;
}
hr {
  color: lightgray;
}
...

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

Comparison of getComputedStyle() and cssText functionality between Internet Explorer and Firefox

Take a look at this example to see the issue in action. I'm attempting to access the cssText property of a <div> using window.getComputedStyle(element) (which provides a CSSStyleDeclaration object). While this works smoothly in Chrome, it' ...

Flipping over every single card, but only desire to flip them one at a time

My attempt to flip these cards individually has resulted in them all flipping together. I suspect there may be an error in my JavaScript code. In the original code, I used images in front and an unordered list in the back, but here I have simplified it t ...

When the navbar collapses, it pushes non-collapsible elements aside to make room

I'm facing an issue with my navbar design. Currently, I have a navigation bar with a toggle button that collapses the menu on smaller screens. However, I want to prevent a specific element, which I refer to as the "army of shopping carts", from collap ...

"Exploring the vibrant world of colors with Colorbox: a

In one of my projects, I am utilizing colorbox to create a video gallery. One feature I am trying to implement is to display the video description underneath each video when opened in the colorbox modal. Currently, here is what I have: <script> $( ...

Can the change listener be used to retrieve the selected option's number in a form-control?

This particular cell renderer is custom-made: drop-down-cell-renderer.component.ts import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-drop-down-cell-renderer', templateUrl: './drop-down-cell-r ...

Toggle the menu using jQuery on unordered list items

Below is the HTML code I am using : <ul class="main-block"> <li class="firstLevel"> <a href="#category">EXAMPLE CATEGORY 1</a> <ul class="dijete"> <li class="child"> <a href="some-sub-categ ...

Load Angular template dynamically within the Component decorator

I am interested in dynamically loading an angular template, and this is what I have so far: import { getHTMLTemplate } from './util'; const dynamicTemplate = getHTMLTemplate(); @Component({ selector: 'app-button', // templat ...

The variable $ jQuery is not defined in this context

I encountered this issue while working in my browser console: Uncaught ReferenceError: $ is not defined Here's a snippet of the HTML code causing the error: <div class="form-group"> <label for="make">Make</label> ...

Is there a way to view images embedded in local .msg files in a web browser in HTML format?

Does anyone know how to display embedded pictures in local .msg files when opening them in a web browser using HTML format? Currently, when I open the .msg file with embedded pictures, all I see is a blank space indicating "picture not found." Interestin ...

When viewed on a mobile device, the entire HTML document is resized to occupy less than half of the

Whenever I adjust the size of my webpage on different devices or mobile phones, I notice that the <div> tag appears to be only half (or even less) the width of the page. This gap seems to increase as the window size decreases. Refer to the screenshot ...

What are some techniques for reducing lengthy XPath expressions containing a multitude of OR options?

I am attempting to use Selenium to iterate through numerous alternative conditional XPaths in order to locate elements that could potentially match – and then pass that information to the object elmnt. As of now, utilizing the OR operator (|), the code ...

Is there a way to transfer HTML and JavaScript data to an SQL database and then display it on the same JSP page?

My journey started with an HTML page. However, I decided to switch things up by renaming the file and giving it a .jsp extension because I plan on using JSP to complete this specific task. The task involves extracting a value from a form on the page, send ...

Utilizing Bootstrap, Jquery, and Node.js for web development

I am seeking clarification on the process for running these two commands: npm install jquery npm install boostrap After adding the dependencies to my package.json file, I then include them in my app.js file using the code: var $ = require('jquery&a ...

The slider feature on Google Reviews is currently not functioning properly with the owl carousel

I am facing an issue with integrating Google Reviews slider using Google API and owl carousel. The problem lies in the fact that the Google reviews data is appended last after the page has loaded completely. This causes the owl carousel function to be call ...

Animation using CSS keyframes for simultaneous manipulation of various properties

I am facing a challenge with animating both the bottom and left properties of an object inside a container div simultaneously. How can I make it move diagonally? Despite using keyframes, the following code does not seem to achieve this effect: #containe ...

Locking the axis labels to the top of the plot in R shiny

My giraffe rendering is very long, and I want the x-axis values to remain visible as the user scrolls down. Below is a sample code that demonstrates this concept. I am open to different types of plots as long as they display the labels when hovering over ...

Is there a solution to the rough edges seen in a poor quality SVG mask by implementing anti-aliasing techniques?

I created an SVG mask animation. However, I am facing an issue with the edges of the SVG appearing jagged. There is a slight black edge around the mask during the animation, which affects its quality compared to animated GIFs. I expected cleaner results us ...

Struggling to understand how to collect form data in Angular

I am attempting to create a prototype of a login page, where I need to extract the entered username and password values from the form in order to validate whether the user should be granted access. Despite reviewing numerous tutorials on this topic, I&apos ...

Dynamic styling with jQuery input focus animation

Whenever I interact with the input field, I want my border colors to animate in and fade out smoothly. But I'm facing some challenges. Here is how I've set it up: HTML <input type="text" id="search-input" placeholder=&quo ...

Adjust the class based on the number of li elements

When there are more than two (li) tags, the ul tag should have the class "col_3"; otherwise it should have the class "col_2" For instance: If there are two columns <div class="container"> <ul class="col_2"> <li>One</li> ...