Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align Div at bottom on main Div

Tags:

html

css

I have two divs, one inside the other and I would like the small div to be aligned at the buttom of the main div.

Here's my code so far. Currently, the button is at the top of main div, instead I want it positioned at the bottom. Any help would be appreciated.

.vertical_banner {     border: 1px solid #E9E3DD;     float: left;     height: 210px;     margin: 2px;     padding: 4px 2px 10px 10px;     text-align: left;     width: 117px; }  #bottom_link{  vertical-align: bottom; } 

Here's how I've been trying to use it, but as you can see I'm still new to CSS :)

<div class="vertical_banner">     <div id="bottom_link">          <input type="submit" value="Continue">        </div> </div> 
like image 931
Helen Neely Avatar asked Sep 04 '11 19:09

Helen Neely


People also ask

How do I align an element to the bottom?

Use the text-align property to align the inner content of the block element. Use the bottom and left properties. The bottom property specifies the bottom position of an element along with the position property. The left property specifies the left position of an element along with the position property.

How do I position something at the bottom of a page in CSS?

If position: absolute; or position: fixed; - the bottom property sets the bottom edge of an element to a unit above/below the bottom edge of its nearest positioned ancestor. If position: relative; - the bottom property makes the element's bottom edge to move above/below its normal position.

How do I align the content of a div to the bottom in bootstrap?

align items to the left or right make sure that you include the entire d-flex align-items-end flex-column on the parent element and choose start or end depending if you want it to be aligned left or right. align item to the bottom Then, use mt-auto on the div that you want to stick to the bottom of the parent.

How do I extend a div to the bottom of the page?

Set the height of html, body to 100% . Then, you can set the last <div> 's height to 100% and it will be as tall as the window.


1 Answers

Modify your CSS like this:

.vertical_banner {      border: 1px solid #E9E3DD;      float: left;      height: 210px;      margin: 2px;      padding: 4px 2px 10px 10px;      text-align: left;      width: 117px;      position:relative;  }    #bottom_link{     position:absolute;                  /* added */     bottom:0;                           /* added */     left:0;                           /* added */  }
<div class="vertical_banner">      <div id="bottom_link">           <input type="submit" value="Continue">         </div>  </div>
like image 59
Sarfraz Avatar answered Sep 28 '22 05:09

Sarfraz