Reputation: 49
I'd like to know how I can align an element to the bottom of a div in CSS.
Here is a screenshot of my page: http://prntscr.com/5ivlm8 (The arrow is to show where I want the element to go)
And here is my page:
<?php include 'head.php'; ?>
<div class="wrap">
<div id="base">
<div class="infobox">
<div class="title">
Welcome to <?php echo NOM_SITE; ?>
</div>
<div class="time">Today is <?php echo date("d/m/Y") ?></div>
</div>
<div class="enter">
Test
</div>
</div>
</div>
And here is the "Enter" div CSS:
#base .enter {
height: 40px;
min-width: 60px;
background-color: #000000;
position: absolute;
bottom: 0;
left: 0;
}
Upvotes: 0
Views: 88
Reputation: 1834
#base{
position:relative;
top:0;
left:0;
}
.enter{
position:absolute;
bottom:0;
top:100%;
left:0;
}
Upvotes: 1
Reputation: 2460
you should use a Position:relative on #base(parent) it controls the .enter(child div) with in parent div,
css:
#base{
position:relative;}
#base .enter{
position:absolute;
bottom:0;}
Upvotes: 1
Reputation: 6292
Here you will have to set the position of div with id=base to relative so that the enter div can adjust itself with it at the bottom left. Just include the below to your css
#base
{
position: relative;
}
Upvotes: 1
Reputation: 272066
The #base
element needs to be positioned. Use position: relative
on #base (absolute or fixed will also work).
Upvotes: 1