I want the #copyright to be at the bottom of #outer
Here is the css for #copyright
#copyright{
position:relative; margin-bottom:0px; width:672px; height:20px; color:#FFF;
}
#yr{
margin:auto;
}
#f{ position:absolute; right:0px; text-align:center;
}
Thanks Jean
Just set element child to position: relative and than move it top: 100% (that's the 100% height of the parent) and stick to bottom of parent by transform: translateY(-100%) (that's -100% of the height of the child).
You can use the CSS position property in combination with the z-index property to overlay an individual div over another div element. The z-index property determines the stacking order for positioned elements (i.e. elements whose position value is one of absolute , fixed , or relative ).
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.
#copyright {
position: absolute;
bottom: 0;
}
#outer {
position: relative;
}
This will have the unfortunate side effect though that #copyright
does not count towards the height of #outer
anymore, in your example #outer
would be 0px high. You can add a bottom-padding to #outer
if you're working with fixed heights.
#copyright {
position: absolute;
bottom: 0;
height: 200px;
}
#outer {
position: relative;
padding-bottom: 200px;
}
#outer {
height: 100px;
border: 1px solid red;
position: relative;
}
#copyright {
position:absolute;
height: 30px;
bottom: 0;
left: 0;
border: 1px solid black;
width: 300px;
}
<div id="outer">
<div id="copyright">
<span id="yr">© 1965 - 2010</span>
<span id="f"></span>
<span id="d"><span>
</div>
</div>
Also, never use "0px". There is no such thing as zero pixels, only zero. Correct way is "right: 0;"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With