Is there a way to position the navbar at the bottom of the page?

Is there a way to position this navbar at the bottom of the page? I've tried using different properties like bottom or margin-bottom, but it doesn't seem to work. Could there be a CSS configuration preventing these commands from taking effect?

HTML

<!doctype html>
{%load staticfiles%}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Home</title>
    <link rel="stylesheet" href="{%static 'index/css/index.css'%}">
    <link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/glacial-indifference" type="text/css"/>
    <script src="https://kit.fontawesome.com/b525a42bf1.js" crossorigin="anonymous"></script>
</head>
<body>

<div class="logo"><h2>MediTracker</h2></div>

<nav>
    <div class="menu">
        <ul class="clear">
            <li><a href="" title="home"><i class="fa fa-home"></i><span class="link-text">Home</span></a></li>
            <li><a href="" title="about"><i class="fa fa-question-circle"></i><span class="link-text">About</span></a></li>
            <li><a href="" title="pricing"><i class="fa fa-money-bill-alt"></i><span class="link-text">Pricing</span></a></li>
            <li><a href="" title="services"><i class="fa fa-tools"></i><span class="link-text">Services</span></a></li>
            <li><a href="" title="contact"><i class="fa fa-phone"></i><span class="link-text">Contact Us</span></a></li>
        </ul>
    </div>
</nav>


</body>
</html>

CSS

body{
    background-color: #333;
    background-size: cover;
    background-position: center;
    font-family: 'GlacialIndifferenceRegular';
    overflow: hidden;
    font-weight: 600;
    height: 85vh;
}

a{
    text-decoration: none;
}

.clear:after{
    content: "";
    display: block;
    clear:both;
}

nav .menu{
    text-align: center;
    margin-bottom:0px;
    width: 100%;
}

nav .menu ul{
    list-style: none;
    display: inline-block;
}

nav .menu ul li{
    float: left;
    width: 150px;
    height: 150px;
    background-color: white;
    transition: background-color 0.2s linear 0s;
}

nav .menu ul li a{
    display: table;
    width: 100%;
    height: 100%;
    position: relative;
    text-align: center;
}

nav .menu a i{
    display: block;
    vertical-align: middle;
    color: #333;
    font-size: 23px;
    transform: all 0.2s linear 0s;
    padding: 44px 0 10px;
}

nav .menu a i:before{
    width: 41px;
    display: inline-block;
    height: 41px;
    line-height: 37px;
    transition: color 0.2s linear 0s,
                font-size 0.2s linear 0s,
                border-color 0.2s linear 0.2s,
                height 0.2s linear 0s,
                line-height 0.2s linear 0s;
}

nav .menu a .link-text{
    right: 45px;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    transition: all 0.2s linear 0s;
}

nav .menu ul li:hover{
    background-color: #42d3e3;
}

nav .menu ul li:hover + li:last-child{
    border-right-color: blue;
}

nav .menu ul li:hover .link-text{
    opacity: 0;
}

nav .menu ul li:hover i{
    color: #333;
    font-size: 50px;
}

nav .menu ul li:hover i:before{
    border-color: transparent;
    border-radius: 500px;
    line-height: 40px;
    transition: color 0.2s linear 0s,
            font-size 0.2s linear 0s,
            border-color 0.2s linear 0.2s,
            height 0.2s linear 0s,
            line-height 0.2s linear 0s;
}

Answer №1

One potential solution is utilizing the position:fixed CSS property:

header{
   position:fixed;
    top:0;
    left:0;
    width:100%;
}

Answer №2

To achieve the desired effect, you can specify nav .menu with position: absolute; bottom:0;

nav .menu{
    text-align: center;
    margin-bottom:0px;
    width: 100%;
    position: absolute;
    bottom:0;
}

Here is a JsFiddle link for reference: https://jsfiddle.net/viethien/gxw0dacb/3/

Answer №3

If you're looking to position an element at the bottom of the user interface, simply adding margin-bottom: 0 won't achieve that effect. Try including bottom: 0 in your CSS as well. The combination of these properties ensures that the element is positioned right at the bottom with zero space below it. To clarify, here's how the code for the navbar should be structured:

nav .menu{
    text-align: center;
    margin-bottom: 0px;
    bottom: 0;
    width: 100%;
}

To learn more about utilizing the bottom property, visit this resource.

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

What is causing the inconsistency in the widths of these HTML elements?

I recently created multiple div elements with a uniform width of 5px. Here is the CSS code I used: div { background-color: black; width: 5px; height: 100px; display: inline-block; } To my surprise, despite setting the same width for all divs, som ...

Is it possible to modify the CSS of a single class when hovering over a child class of a different and unrelated class?

I am struggling with CSS combinators, especially when dealing with nested div, ul, and li elements. My issue involves changing the CSS of a div with the class "H" when hovering over li elements with the class "G". Since all of this is contained within a s ...

Adding HTML attributes to a VueJS table allows for more customization and control

Is it possible to incorporate HTML/Bootstrap elements into a cell in VueJS? <b-table striped show-empty :items="filtered"> <template slot="top-row" slot-scope="{ fields }"> <td v-for="field in fields& ...

Error communicating with MySQL Server in PHP: Connection access denied

Hey everyone, I've been working on a registration page that's supposed to add information to a SQL Table. I've included my PHP code below, but I'm encountering some errors. Can anyone help me figure out what's wrong? <?php $con= ...

Trouble getting proper alignment displayed with JavaScript and CSS

If anyone has a solution for printing content in a div using JavaScript and CSS, please help. The main div with the id 'preview' contains content taken from a database using PHP and MySQL. However, the data on the print page appears vertically an ...

Populating check boxes in a jQuery multiselect dropdown based on option text

I want to implement the jQuery multiselect plugin, but the checkboxes are appearing after the option text. Is there a way to configure them to be on the left side? https://i.sstatic.net/2oB2y.png ...

The Opera browser displays a horizontal orientation for vertical menus

Having some trouble with my vertical menu rendering correctly in different browsers. It's appearing horizontal in Opera, but looks good in Firefox and Chrome. I'm pretty sure it's just a small tweak needed in the code, but I can't quite ...

Adjusting the sensitivity of mousewheel and trackpad using JavaScript

I am currently utilizing CSS3 to smoothly move a div up and down based on the direction of scrolling. By monitoring the mouse wheel event, I can detect when a user scrolls down and trigger a CSS3 transition to slide the div up. However, I am encountering a ...

Is it possible to prioritize CSS selectors in a specific sequence?

I possess a pair of div elements: div class="one two three" div class="three two one" Is it probable to formulate a CSS regulation that exclusively focuses on ".one.two.three" and does not encompass ".three.two.one" ? ...

Using React to wrap a cards-deck inside a cards component with plain bootstrap styling

Hello everyone, I'm currently working on creating a deck of cards using plain Bootstrap. In my main file, I have set up the deck as follows: <div className="container"> <div className="card-deck"> <MyCard /> & ...

The file-loader in Webpack is failing to copy the files and update the URL

I am encountering an issue with webpack file loader where it is not outputting image files. This problem arises while also importing HTML files as partials in my Angular app. Below is my webpack configuration for handling images using the file-loader: [w ...

What is the best method to extract the value of a TextField from an HTML file and transfer it

I am a newcomer to Nativescript and I'm interested in storing user data on my mobile device using Couchbase database. Currently, I have set up TextField elements for users to enter their first name and last name, with a save button available. My quest ...

What steps should I take to incorporate dark mode into my current SCSS and Angular configuration?

I am currently utilizing Angular 13 and SCSS in my project. My goal is to incorporate Dark Mode for the application, here is my existing setup. _variables.scss $body-color: #f0f0f0; :root { --body-color: #{$body-color}; } Throughout the application, i ...

Angular2 - the pipe was not located while organizing records

I've successfully fetched data from an API and displayed it in the view, but I'm struggling to organize the data by date. Whenever I attempt to do so, I encounter this error message: The pipe 'groupBy' could not be found pipe.ts impor ...

The functionality of Bootstrap icons is not functioning properly

After downloading a customized version of Bootstrap with only the icons, I encountered issues trying to incorporate them into my site. Despite copying and pasting the icon styling into my existing bootstrap.css file, the icons were still not displaying pro ...

The CSS3 animations using transit do not occur at the same time in Internet Explorer and Firefox

I am currently developing a presentation library to simplify my work. Naturally, animations play a significant role in this project. The library leverages Transit for smooth CSS3 animations. One specific animation involves an element sliding into or out o ...

Using a Bootstrap navbar in place of a select element

Currently, I am noticing that styling options for a <select> with <option> are quite limited. To overcome this, I am exploring the idea of implementing a bootstrap menu, which offers a wider range of styling possibilities. Here is the basic str ...

The background image in CSS refuses to display

My CSS background image isn't displaying properly. Here is the code snippet from my HTML: <div class="container-fluid p-c b-g"> <div class="row"> <div class="col-sm-12 text-infom"> </div> </div> </ ...

Triggering this function when clicked

I am trying to figure out a way to trigger this code onClick instead of automatically. Can anyone help me with this question? Below is the JavaScript code snippet: $("input[type=radio],button").each(function () { var outputName = $(this).attr("d ...

What causes hyperlinks to fail in certain emails when opened in new tabs on Outlook Webmail?

After opening an email in a new tab on Chrome from Outlook 365 web app, I noticed that some hyperlinks stop working. Strangely, for certain emails I received, the hyperlinks work fine. I create these emails using Power Automate and the HTML code I use is: ...