Reputation: 17333
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.
Upvotes: 0
Views: 4420
Reputation: 94101
If your element is at body
level this should work:
#element {
position: absolute;
top: -100%;
}
Upvotes: 0
Reputation: 219920
CSS:
#theElement {
position: fixed;
bottom: 100%;
}
jQuery:
var $el = $('#theElement');
$el.css({
position: 'fixed',
top: '-' + $el.outerHeight()
});
Upvotes: 2