I want an absolutely-positioned element to be just out of the browser window - just off the top of the browser viewport. Note that I cannot provide an exact height of the specified element.
Can this be done? If not, using jQuery is fine too.
I want an absolutely-positioned element to be just out of the browser window - just off the top of the browser viewport. Note that I cannot provide an exact height of the specified element.
Can this be done? If not, using jQuery is fine too.
CSS:
#theElement {
position: fixed;
bottom: 100%;
}
jQuery:
var $el = $('#theElement');
$el.css({
position: 'fixed',
top: '-' + $el.outerHeight()
});
If your element is at body
level this should work:
#element {
position: absolute;
top: -100%;
}