What is the best way to position a div at the bottom of a web page?

I have a question that may seem basic, but I've been struggling to find a solution. Despite searching for answers, none of the suggestions I've come across have worked for me. My application has two main containers - a header and a content div. The challenge is to make the content div dynamically reach the bottom of the page based on the browser size.

I attempted using properties like height:100vw, but it made the page too long and added a scroll bar. Setting the height to 100% had no effect either.

My setup involves Angular with Bootstrap and ui.bootstrap. Here's how it's loaded into the index:

<div class="app-container">
  <navbar></navbar>
  <div ng-view=""></div>
  <div class="footer"></div>
</div>

The navbar is a custom directive that loads a template, while ng-view looks like this:

<div class="content-container">
  //content
</div>

In essence, I need the content-container div to always extend to the bottom of the page. I've explored JavaScript solutions, but haven't found any specific to Angular.

Solution

(credit to Vinc199789)

height:calc(100vh - header_height);

Answer №1

Have you experimented with using a position of absolute and setting the bottom to 0px?

.container{
     position:absolute;
     bottom:0px;
}

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

Aligning a child element in the center along the horizontal axis within a parent container that is smaller in width than

I have been attempting to center an <img> element horizontally within a <div> that is narrower than the image itself. The <div> has overflow: hidden applied to it. For example, if the image is 500px wide and the DIV is 250px wide, is the ...

Transferring variables from parent scope to the ui-view component

I'm currently utilizing angular-ui/ui-router and have directives/components with isolate scope declared for rendering on state change. $stateProvider .state('about', { url: '/about', template: '<about>&l ...

What is the best way to insert a Bootstrap Glyphicon into an asp:TextBox within ASP.Net Webforms?

Can a Glyphicon be displayed in an <asp:TextBox> control? I attempted the following: <div class="col-md-10 has-feedback"> <asp:TextBox runat="server" ID="txtFullName" CssClass="form-control" MaxLength="50" /> <i class="glyph ...

Leveraging Iframes for efficient user authentication within an Angular application

Incorporating an Iframe into one of my templates for authentication has presented certain challenges. Case in point: When a user finishes a training session, they must verify their identity by authenticating with a ping identity server that will redirect ...

Limiting decimal places in Angular filter

Is there a way to create a custom filter that takes an input, specifies the maximum number of decimals to display, and returns a string formatted according to locale rules? Input(number) Output for 1 decimal Output for 2 decimals 1.01 1 ...

The presence of Bootstrap remains hidden unless space is designated for it

Question about Bootstrap 5.1.3: Is there a way to hide elements on a page using the bootstrap class ".invisible" without allocating space for them? Currently, when the elements are set to visible using the class ".visible", they occupy space on the page ...

Creating a clickable image overlay card in Bootstrap 4 - A simple tutorial

I'm trying to use the Bootstrap 4 card element to create a grid of images with overlaid headings, but I'm having trouble linking the image itself. I attempted the stretched link method without success. I also tried placing the entire card in an ...

Undefined boolean when passing to AngularJS directive

I developed a custom directive that allows for the addition of a gradient background color in AngularJS: .directive('colouredTile', function () { return { restrict: 'A', controller: 'ColouredTileController&apos ...

How can I locate a div element using multiple class names?

<div class="value test" /> I am trying to locate this specific element on the web page which has two classes assigned to it. Since className does not accept space-separated values, I am exploring alternative ways to achieve this. Any suggestions? ...

Can you show me a method to integrate this HTML and CSS code into a Teachable page successfully?

Hey there, I've been encountering some challenges while working with HTML and CSS on a platform known as Teachable. Essentially, I'm aiming to create a layout with 2 columns: - Column 1 - Image - Column 2 - Text Whenever I apply <div class=" ...

CSS hover effect ceases to function after the button has been clicked once

I am facing a dilemma with styling that I can't seem to resolve. There is a basic toggle feature on my page with two options -- the user can select either Toggle1 or Toggle2, resulting in different data being displayed dynamically based on the active ...

Is there a way I can ensure that two elements have identical heights?

Is there a way to ensure that two different elements in HTML are always the same height using CSS? I attempted to achieve this by setting each element to 50vh in the CSS, but it didn't work. codepen: https://codepen.io/ichfickedeinemutterdudummerwich ...

Spring Boot application on Prime Faces is not displaying CSS after deployment to Heroku

I'm currently using a combination of Spring 3.1.3, Prime Faces 3.4.2, Hibernate 3.6.8, and Pretty Faces 2.0.4. When I deploy my application on a local server (Apache Tomcat 7), the CSS displays properly. However, when I deploy the same project to Her ...

Callback for deletion in the Mean Stack

I have successfully implemented the delete functionality in my Mean stack application; however, I am facing an issue with updating the view after deleting an item from the JSON. On the server side of my express logic: .delete(function(req, res) { Ser ...

Refreshing the page using location.reload triggers a reload of various elements

I am currently working on a website that supports multiple languages and utilizes a cookie named nav_lang to determine the user's preferred language for navigation. Whenever a user selects a new language, the cookie is updated accordingly and the page ...

Adjusting the amount of rows and columns in a fluid manner with CSS grid (updated)

After conducting my research, it seems that the most effective way to set the final value of a CSS grid is either by directly specifying it or by creating/manipulating the css :root value. A similar query was previously raised here, although the answers p ...

Positioning an absolute div inside a relative div within a v-for loop while using VueJS and Element UI

I am experimenting with rendering a list of <el-card> items using a transition-group. Each card has a front and back side that flip when a button is clicked. To achieve a smooth flip transition, I need to apply the style: position: absolute; top: 0; ...

Pressing the button will allow you to select and copy the text within the

I am looking to incorporate a mock-chat feature into my website. The concept is to type something on the website, then click a button next to it which will move the text to a frame above. I attempted this using a textarea and even found a code for selectin ...

How to clear a 24-hour-old template from the Angular 1 cache?

I have implemented the following rule to clear template cache in my AngularJS application: myApp.run(function ($rootScope, $templateCache) { $rootScope.$on('$viewContentLoaded', function() { $templateCache.removeAll(); }); }); Howe ...

"Exploring the process of obtaining a compilation of Materialize CSS chip elements within an AngularJS framework

<div ng-repeat="job in jobList" > <div class="chip" id="jobchip" ng-model="jobchip"> <label for="jobchip"> Available Jobs</label> {{job.Name}} <i class="close material-icons">close</i> < ...