Struggling to properly center the footer on my Django template

I'm currently facing an issue when attempting to align my footer in the center of my Django template. The specific class for the footer is Pagination.

Base HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <title>Flickr Photobrowser</title>
        <style>
        html, body {
            height: 100%;
        }
        * {
            margin: 0;
            padding: 0;
        }
        #wrap {
            min-height:100%;
        }
        #header {
            background: #111;
            color: white;
        }
        #header, #content {
            padding: 10px 150px 10px 150px;
        } 
        #content {
            overflow:auto;
            padding-bottom: 150px;  
        }
        pagination {
            position: relative;
            margin-top: -150px; 
            height: 150px;
            text-align: center;
        } 
        h1 {
            font-family: Georgia;
            font-weight: 100;
            font-style: italic;
            font-size: 30px;
            padding-top: 50px;
        }
        h2 {
            font-size:20px;
            margin-top: 5px;
            color: #ff0080;
            margin-bottom: 5px;
        }
        #image {
            float:left;
            padding: 2px;
        }
        .thumbnail {
            position: relative;
            z-index: 0;
        }
        .thumbnail:hover {
            background-color: transparent;
            z-index: 50;
        }
        .thumbnail span { 
            position: absolute;
            background-color: lightyellow;
            padding: 5px;
            left: -1000px;
            border: 1px solid #000000;
            visibility: hidden;
            color: black;
            text-decoration: none;
        }
        .thumbnail span img { 
            border-width: 0;
            padding: 2px;
        }
        .thumbnail:hover span { 
            visibility: visible;
            margin-left: auto;
            margin-right: auto;
            top: 0;
            left: 10px; 
        }

        </style>
    </head>

    <body>
        <div id="wrap">
            <div id="header"><h1>Flickr Photobrowser</h1></div>
            <div id="content">
            {% block content %}
                <h2>Welcome!</h2>
                <p>This sample application demonstrates how to authenticate against Twitter using their oAuth API.<br>Click below to begin authentication:</p>
                <p><a class="auth" href="auth/">Authenticate »</a></p>
            {% endblock %}
            </div>

        </div>
        {% block footer %}
        {% endblock %}
    </body>

</html>

Actual Page HTML:

{% extends "base.html" %}

{% block content %}
<form method="get" action="../photouser/">
Flickr username: <input type="text" name="username"> 
<input type="submit" value="submit">
</form>
<p>Search by <a href="../phototags/">tags</a>?</p>
<p><h2>Displaying photos for {{ username }}</h2></p>
<ul>
{% for photosmall, photobig, actualimage in photopages.object_list %}
<div id="image"><a class="thumbnail" href="{{ actualimage }}">
<img src="{{ photosmall }}"/><span><img src="{{ photobig }}"/></span>
</a></div>
{% endfor %}
</ul>

{% endblock %}

{% block footer %}
<div class="pagination">
    <span class="step-links">
        {% if photopages.has_previous %}
            <a href="?username={{ username }}&page={{ photopages.previous_page_number }}">Previous</a>
        {% endif %}

        <span class="current">
            Page {{ photopages.number }} of {{ photopages.paginator.num_pages }}
        </span>

        {% if photopages.has_next %}
            <a href="?username={{ username }}&page={{ photopages.next_page_number }}">Next</a>
        {% endif %}
    </span>
</div>
{% endblock %}

Answer №1

Seems like the only issue here is a small typo.

Your CSS code currently targets an element called <pagination>, but you actually have:

<div class="pagination">

To fix this, simply update your CSS selector to:

.pagination 

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

Is there a way to alter multiple classes using hover effect on a single class without the use of JavaScript, only employing

Hello there! I have a question about applying styles to specific classes when hovering over certain elements. Unfortunately, I am unable to make changes to the HTML files and can only work with the CSS file. Take a look at the image below for reference: ht ...

Django - hosting a single-page application from a static directory

Our django server serves as both our API and operations backend. I am currently focused on enhancing our ops backend by developing a Vue SPA to gradually replace the existing one. As a frontend developer, I find myself struggling with the complexities of ...

When attempting to upload an API object, the error message '"'Image' object is not callable"' is displayed

Update 2, 13th Jan: Following a thorough bug search and attempting to post the object directly in the root API using json, I've concluded that the issue causing the posting error is related to the image. I utilized the HTML form to post an object, re ...

"Having the same meaning as $(this) in jQuery, the CSS

Is there a CSS equivalent to the Jquery selector $(this)? For example: .widget h4 { background: black } .widget:hover h4 { background: white } In this scenario, when any element with the .widget class is hovered over, the child h4 changes its background ...

adjust the size of a form field to match the background image dimensions

I'm encountering an issue while trying to solve this particular challenge: My goal is to integrate a login box onto a full-screen image. Although I've come across numerous methods for incorporating an image into a form field, my task requires me ...

You are unable to utilize the extra_option feature alongside the django path

I'm having trouble using the path() method in my urls.py file despite following the documentation provided at: https://docs.djangoproject.com/en/2.0/topics/http/urls/#passing-extra-options-to-view-functions. Below is the code snippet I have: from dj ...

Having issues with the Carousel feature in Bootstrap 5.3.1 while using Angular version 15

I'm currently in the process of setting up a carousel on my homepage. It seems like everything is in place, but there's something missing. The initial image, text, and arrows all display properly, but they are non-functional. I have correctly imp ...

Creating a primary php file in Apache without the use of SQL or any database: is it possible?

Forgive me if this comes across as rude, but I'm struggling to grasp the concept of apache, PHP, and servers in general. To help myself understand better, I want to create a very basic website that assigns an ephemeral ID to each user (not a session). ...

Foundation Unveil Modal hidden from view

I'm currently integrating modals using Foundation 5 in a Rails application. The issue I'm facing is that the modal only works when the page is not scrolled down. If you scroll to the bottom of the page and try to activate the modal by clicking ...

I encountered the issue: "The specified resource is not a valid image for /public/logoicon/logoOrange.png, it was received as text/html; charset=utf-8."

I encountered an issue when trying to incorporate a PNG or SVG file into my code. What steps should I take to correct this error and enable the images to display properly? import Head from 'next/head' import Image from 'next/image' impo ...

Elevate the block when encountering errors in HTML/CSS

Here is a picture of what I want, and below I will provide a more detailed description: Link to the image (I cannot paste it here) I am explaining the elements involved. There are three main components: 1) The topmost text "Bla bla bla bla" 2) The butt ...

AngularJS enables the loading of directives dynamically, but sometimes encounters errors such as "Restricted URI access denied."

Presently, I am in the process of developing a small educational project using HTML5, CSS, JS and AngularJS. Hiccup: Loading an AngularJS Directive in my index.html file Error code [1] - Local browser Error: Access to restricted URI denied Various resp ...

Divide data into an HTML table and merge it with header information

My HTML form contains an interactive HTML table where users can add/delete rows. I am sending this data to a Google Sheet and need to store the row information with corresponding header details. Each time a user submits the form, a new row is added to the ...

Eliminate the navigation bar option from a website template

Is there a way to permanently eliminate the menu button in this theme? Any guidance would be appreciated. Here's the link to the theme: https://github.com/vvalchev/creative-theme-jekyll-new ...

What is the best method for converting a variable with HTML content into a printable string?

In an attempt to display user-entered data from a text box to an HTML div, there seems to be an issue when the data contains HTML content. Instead of displaying the content as a string, it shows it as HTML elements. For example: let text = "<h1>Worl ...

Alter div elements with jQuery based on the particular link that was selected

I'm struggling with updating a nav bar that has different divs based on the link clicked. <script> $(document).ready(function (){ $("#content").load("content/index_content.php"); $('a').click(function(){ $ ...

Achieve full height Bootstrap styling by nesting it inside a row div

Is there a way to make the height of the left sidebar div equal to 100% within a row, based on the height of the right content? I have tried setting the height to 100%, but it doesn't seem to work. Any advice would be appreciated. <body> < ...

Issues encountered when trying to implement a Navbar drop-down menu using Angular in conjunction with Bootstrap 4

I'm currently working on a web application using Angular 5 and Bootstrap 4, and I've encountered issues with the navigation menu bar dropdowns. Despite following the guidelines provided in the official documentation here, I can't seem to get ...

"Discovering a button press using the Gamepad API: A Step-by-Step Guide

I'm currently building a web page that can detect button presses on an Xbox controller and display a boolean value based on the pressed button. Right now, I have successfully managed to detect when a controller is connected and show it as a string. Ho ...

Shape with smoothed corners

Is there a way to create rectangles with rounded corners using CSS, SVG, or other methods while maintaining straight horizontal and vertical sides? I attempted to use border-radius for the rounded corners, but found that it created curved edges on both ho ...