Efficiently adjusting the height of a sticky sidebar

I am currently implementing a Bootstrap grid with two divs in a row. I need my reply-container to be fixed (sticky). However, when setting position: fixed; it is affecting the element's width by adding some additional width. With position: sticky, setting height: 100%; results in the sticky behavior working well but the element does not reach full height. On the other hand, setting min-height allows the element to be full height but it loses its sticky functionality. How can I achieve a sticky div with full height?

<template>
  <div class="container-full">
    <div class="row">
      <div class="col-8">
        <div class="tweets-container">
          <div
            v-for="tweet in tweets"
            :key="tweet.id"
          >
          </div>
        </div>
      </div>
      <div class="reply-container col-4">
        <h1>Replies</h1>
      </div>
    </div>
  </div>
</template>

<style scoped>
.tweets-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.tweet-card {
  background: #fff;
  border-radius: 5px;
  padding: 3px 6px;
  min-height: 125px;
  border: 1px solid #6e6b7b;
}

.reply-container {
  background: #fff;
  position: sticky;
  right: 0;
  top: 0;
  height: 100%;
  /*min-height: 100%;*/
}
</style>

Answer №1

Shortly after my initial post, I found the solution by using height: 100vh; instead of height: 100%;

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

Updating Vuetify MDI icons in Nuxt.js: A Step-by-Step Guide

When using Vuetify with Nuxt.js, I am facing an issue where some material design icons are not displaying properly. For example, <v-icon>mdi-cog</v-icon> appears as blank. However, other icons are working fine. nuxt.config.js buildModules: ...

Displaying items in the shopping cart across two separate columns

I have a website located at Within that page, I have included the Cart table using a woocommerce shortcode. Currently, the cart table is positioned below the billing details and payment options section. My goal is to move this cart table to be situated ...

Challenges with Auth0 and vue.js appState.target when navigating between different domains

Currently, I am in the process of setting up a project that leverages vue.js on the frontend while incorporating Auth0 for authentication. The plan is to have a landing page where users can log in, followed by a series of small web applications running on ...

Is HTML5 data-target used for loading pages?

Currently, I am working with some HTML5 code: <li class="tile google" data-target-activation="click" data-target="loading"> <div> <a href="#">Search Google</a> <h2>Google</h2> </div> </li> Upon ...

Expanding a responsive HTML background image using Javascript

I've spent countless hours grappling with this code, attempting to dynamically resize the background of HTML based on the browser window size using JavaScript. Here's what I have so far (I'm using Firefox for this): GM_addStyle('body ...

Intellisense with JavaScript methods is not supported in Vue files

While running Vue 2.6 in VSCode, I've noticed that my intellisense functions perfectly within js files. However, as soon as I switch to a vue file, all my intellisense capabilities disappear. I have the most up-to-date version of VSCode installed and ...

Delving into the World of CSS

I have been working on changing the background image using this JavaScript code, but I am not sure what to reference in the CSS file. Despite reading through everything, my screen still remains blank. $(function() { var body = $('body'); var bac ...

Scroll to make the div slide in from the bottom

I'm trying to achieve a similar effect like the one shown in this website (you need to scroll down a bit to see the divs sliding in). Although I'm not very proficient in JS, I was able to create a code that makes the divs fade in from 0 opacity ...

Pagination Bug: Index Incorrectly Grabbed Upon Navigating to Next Pages

I encountered an issue with my paginated article list (105 articles with 10 per page). Everything works fine on the first page, but when I click on an article from page 2 onwards, it takes me to the index of the very first article in the array. <div cla ...

Adjust the height of each child element to be half of the fixed height of the parent

There is a wrapper containing multiple boxes generated using ng-repeat from a list. The wrapper has a fixed height of 300px. If the list contains only one box, a class is added to fill the entire space of the wrapper. However, when there are more than on ...

Choosing specific child elements based on their css attribute valuesUnique: "Targeting

I am attempting to customize the appearance of any child divs with the class 'header' that are within parent divs with a class of 'recipes'. I understand that I could simply target .category-recipes .header, but the parent div may vary ...

The thumb of the range input is misaligned with the axis markers

The handle, also known as the knob in this input[type=range] codepen, is not aligning correctly with the ticks. It appears to be off by varying amounts (either left or right) depending on the value. Move the handle to see for yourself. What CSS properties ...

Dynamic Bootstrap User Authentication Form

Currently, I am in the process of constructing a login form for my web application and have opted to use Bootstrap for its styling. To ensure that the screen is responsive, I've integrated the following "Meta Tag" into the structure: <meta name="v ...

When using CSS @media print with inches, different dimensions are displayed post-printing

I'm currently working on a project that involves printing a single div from my webpage. However, I've encountered some issues with the @page tag not affecting the print output as expected. I attempted to manually set the dimensions of the element ...

developing a multimedia player using HTML5

I'm attempting to create a dynamic video "collage" that showcases videos with different aspect ratios in a flexible grid layout. Each row should have videos of the same height, while filling up the horizontal space within a container. With known widt ...

Can someone guide me on how to create scrolling effects for my content? [html/css]

insert image description here Image dedicated to MrXQ I require assistance in verifying the accuracy of the following code - all content displayed below has been altered from the original for privacy concerns My objective is to have the headers scroll o ...

What causes TypeScript to interpret an API call as a module and impact CSS? Encountering a Next.js compilation error

My website development process hit a roadblock when I tried integrating Material Tailwind into my project alongside Next.js, Typescript, and Tailwind CSS. The compilation error that popped up seemed unrelated to the changes, leaving me baffled as to what c ...

What is the best way to show a border-left outside of the list marker in Internet Explorer 8?

I have a numbered list that I would like to add a left border to. <ol class="steps"> <li>item 1</li> <li>item 2</li> <li>item 3</li> <ol> .steps {border-left: 5px double #7ab800;} When viewing in Fir ...

Vue.js plugin goes unnoticed. The error "ReferenceError: jQuery is not defined at eval" arises

I have a Vue 3 project that I am working on and recently tried incorporating the bootstrap-material-datetimepicker library into it. Here is how I included it in my Vue component file: <template> <div> <!-- --> </div> ...

The pre-rendering feature in Nuxt is not able to successfully create static routes

When using Nuxt in spa mode, running npm run generate should automatically create an html file for each static route (i.e., every .vue file in the pages/ folder). However, this is not the case for me. Only a 200.html file is generated (I'm unsure of ...