Reputation: 2781
I have an A4 page for print:
.page
{
width: 21cm;
min-height: 29.7cm;
padding: 1.2cm;
margin: 1cm auto;
border: 1px #D3D3D3 solid;
border-radius: 5px;
background: white;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
Inside this page I'm trying to put in the bottom a table:
<table id="t_obs">
<tr>
<td>TEXT</td>
</tr>
</table>
With the css:
#t_obs
{
position: absolute;
bottom:0px;
}
But only with bottom: -100px it's going to the bottom, why?
Thanks.
Upvotes: 0
Views: 69
Reputation: 5672
When you use position: absolute
the element you position is only positioned with regards to the closest parent with position
specified. If you don't specify position
for any parent it will be positioned relative the body.
If you want your table to be positioned relative the containing .page
element ,then you should add position: relative
to the CSS for .page
.page {
position: relative;
...
}
Hopefully this will help show what I mean: http://jsfiddle.net/2nx8Z/4/
You can read more about positioning here: http://developer.mozilla.org/en-US/docs/Web/CSS/position
Upvotes: 1
Reputation: 7601
Works when you add position:relative
to .page
.
See http://jsfiddle.net/8EZv6/1/
Upvotes: 1
Reputation: 15767
use position:relative
to .page
.page
{
width: 21cm;
min-height: 29.7cm;
padding: 1.2cm;
margin: 1cm auto;
border: 1px #D3D3D3 solid;
border-radius: 5px;
background: white;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
position:relative;
}
Upvotes: 1