Are the navigation links at the bottom of the sidebar?

I've been experimenting with positioning three navigation links at the bottom of a sidebar I created, but I'm having trouble getting them there. Despite my attempts, I can't seem to figure out how to make it work.

The background of the nav links I am trying to position at the bottom are green.

Apologies if this description is unclear, I am relatively new to coding in general.

Here's the HTML code:

<div class="container-fluid">
        <div class="row">
          <div class="col-1 bg-dark position-fixed" id="sticky-sidebar">
            <div
              class="nav flex-column flex-nowrap vh-100 overflow-auto text-white p2"
              id="pink-sidebar"
            >
              <a href="./index.html" class="nav-link"
                ><svg
                  xmlns="http://www.w3.org/2000/svg"
                  height="2rem"
                  fill="#A0C3D2"
                  class="bi bi-house"
                  viewBox="0 0 16 16"
                >
                  <path
                    d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"
                  />
                </svg>
              </a>

              <a href="#" class="nav-link bottom">Gallery</a>
              <a href="#" class="nav-link bottom">About</a>
              <a href="#" class="nav-link bottom">Contact</a>
            </div>
          </div>

CSS code:

#sticky-sidebar {
  padding-left: 0;
  padding-right: 0;
}

#pink-sidebar {
  background-color: #eac7c7;
  align-items: center;
  padding: 1rem;
  display: flex;
}

.nav-link {
  padding: 0.5rem;
  color: #a0c3d2;
  --bs-nav-link-hover-color: #EAE0DA;
}

.bottom {
    background-color: green;
}

/* #main {

} */

Screenshot of my code

I have tried various methods such as setting the sticky-sidebar to display:flex and setting the alignment of the .bottom nav-links to flex-end. I also tried using flex-direction: column-reverse;

I expected the divs containing the links with a green background to appear at the bottom of the sidebar, since I declared it as a flex-column. I might be confusing Bootstrap annotations with regular CSS annotations, but this should be an easy fix and I find it frustrating not being able to resolve it.

Answer №1

To adjust the spacing at the bottom of the home link, which is represented by mb-auto in Bootstrap, simply include margin-bottom: auto like so:

<a href="./index.html" class="nav-link mb-auto">

So the complete code would be:

#sticky-sidebar {
  padding-left: 0;
  padding-right: 0;
}

#pink-sidebar {
  background-color: #eac7c7;
  align-items: center;
  padding: 1rem;
}

.nav-link {
  padding: 0.5rem;
  color: #a0c3d2;
  --bs-nav-link-hover-color: #EAE0DA;
}

.bottom {
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2a4845455e595e584b5a6a1f04190418">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

<div class="container-fluid">
  <div class="row">
    <div class="col-1 bg-dark position-fixed" id="sticky-sidebar">
      <div class="nav flex-column flex-nowrap vh-100 overflow-auto text-white p2" id="pink-sidebar">
        <a href="./index.html" class="nav-link mb-auto"><svg
                  xmlns="http://www.w3.org/2000/svg"
                  height="2rem"
                  fill="#A0C3D2"
                  class="bi bi-house"
                  viewBox="0 0 16 16"
                >
                  <path
                    d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"
                  />
                </svg>
              </a>

        <a href="#" class="nav-link bottom">Gallery</a>
        <a href="#" class="nav-link bottom">About</a>
        <a href="#" class="nav-link bottom">Contact</a>
      </div>
    </div>
  </div>
</div>

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

Persist the checkbox value in the database and update the status of the label accordingly

I need a checkbox for user preference selection that is stored in a MySQL database for constant availability. The label should change to "Enabled" when the checkbox is selected and vice versa. Upon saving (submitting) the page, an alert message should disp ...

PHP is having trouble identifying the file extension for file uploads

After sending an array through AJAX and echoing it in PHP, I have the following data: [file] => Array ( [name] => XXXX.jpg [type] => image/jpeg [tmp_name] => D:\xampp\tmp\phpC5F2.tmp [error] => 0 [size] = ...

Maintain the border styling of a radio button when it is in the selected state

Having an issue with the radio type options - when selected, a blue border appears but disappears if clicking elsewhere. Need the blue border effect to stay even when clicked outside, unless switching to the other option. Looking to align the price in th ...

When the HTML content matches a specific value, initiate a click event to trigger

Can anyone help me troubleshoot? I've tried multiple methods but can't seem to get it right. Here's a breakdown of what I'm attempting to accomplish: #info-NUMBER-btn shows Click to display more information. #info-NUMBER CSS is set t ...

Wordpress Sub-Menu Being Eclipsed by Banner

After upgrading my Wordpress to version 3.5.1, I noticed a problem on my site where the Submenus are loading but quickly getting hidden behind the Banner. Despite trying various modifications in the CSS file, the issue remains unresolved (and might have wo ...

Discovering the quantity of identical elements within a JavaScript array

Looking for some assistance in solving a JavaScript problem as I am relatively new to the language: I have an array and I need help in determining the count of identical values. Below is my array: var arr = ["red", "blue", "green", "red", "red", "gray"] ...

Elements not being styled by CSS properties

I am facing an issue with a CSS file designed to theme a page in white on black, as opposed to the usual black on white. body { background-color: black; } h1 h2 h3 h4 h5 h6 p { color: white; } However, the color: white; property is not being applied ...

How to extract data-bound value from a <span> element using Angular

I have a table that serves as a form, with most of the cells containing input fields. <td><input id="testingInput2" type="number" placeholder="0"step="1" ng-model="addResources.one"> </td> <td><input id="testingInput2" type=" ...

Disabling the scrollbar in Selenium screenshots

When using Chromedriver to capture screenshots of webpages, my code effectively does the job. However, I am now facing an issue with removing the unsightly scrollbars from the image. Is it feasible to inject CSS into the webpage in order to achieve this? W ...

Guide on how to append input field data to a table using jQuery

My current project involves working with a table, and I have encountered some challenges along the way. Typically, I have 4 input fields where I can input data that is then sent to the table in my view. However, if I exceed 4 values and need to add more, I ...

View the picture directly on this page

Currently, I am in the process of creating a gallery and I would like the images to open on top of everything in their original size when clicked by the user. My expertise lies in HTML and CSS at the moment, but I am open to learning JavaScript and jQuery ...

Is it possible to customize the background color of select2 boxes separately for each option?

I recently implemented the select2 plugin and now I'm looking to add a new class within the .select2-results .select2-highlighted class in order to change the background color. Does anyone have any suggestions on how to achieve this? ...

Unable to display the string following a space in the value attribute of an hbs file

<input type="text" class="form-control" id="exampleInputEmail2" name="productName" value={{product.productName}} > When I input 'Smart Phones' into product.produc ...

Solving the right-to-left orientation issue in the Bootstrap navbar

I have implemented a navbar using the code below, which aligns well from the right side. However, the menu items are sorted in ltr order and I need them to be in rtl order, so that "Dropdown 1" starts from the right side of the page. Currently, it appears ...

Having trouble with input event listeners in JavaScript?

I've been attempting to trigger the keyup event using EventListener for an input tag, but it doesn't seem to be working and I'm unsure why. Here is the code I have: document.getElementById("ajax").addEventListener("keyup", function() { ...

Issue with Animate.css animations not working in my Vue 3 application

My goal is to incorporate some basic HTML animations into my Vue 3 application, however I am encountering issues with the Animate.css examples. More specifically, even after installing the animate css dependency using npm install animate.css --save, the s ...

What is the best way to create square editor tabs in Eclipse without using swt-border-radius?

The design of Eclipse's rounded and/or swooshing tabs is starting to feel outdated in today's modern era. I thought that by adding the following line in my default.css file, I could get rid of the rounded corners: swt-corner-radius: 0px Howeve ...

Clickable list element with a button on top

Within my web application, there is a list displaying options for the user. Each 'li' element within this list is clickable, allowing the user to navigate to their selected option. Additionally, every 'li' element contains two buttons - ...

Ways to convert a PHP script to utilize PDO

Previously, a query was used to retrieve website settings stored in the database by an administrator, such as MyCompanyName or Copyright text. These settings were added in the site's backend by the admin. <?php error_reporting (E_ALL ^ E_NOTICE) ...

Unusual marker appearing on every page utilizing ionic v1 and angularjs

For some unknown reason, a dot appears at the upper left side of each page in my webapp: https://i.stack.imgur.com/nN61t.png It seems to be an issue with the HTML code. When I run the snippet below, the dot is visible: <ion-view view-title="Send fe ...