Reputation: 30102
How do I set the bottom CSS attribute of a node in JavaScript?
As in:
.foo
{
position: absolute;
bottom: 100px;
}
Upvotes: 1
Views: 1645
Reputation: 10246
document.getElementsByClassName("foo").style.bottom = "100px";
jQuery recommended:
$('.foo').css('bottom', '100px');
Upvotes: 1
Reputation: 4844
yourObject.style.bottom="auto|length|%|inherit"
Taken from JavaScript and DOM reference here.
Upvotes: 3
Reputation: 59377
Depends. In raw javascript, it will be a little different by browser. The easiest way to do that is to use something like jQuery, and then it's as easy as:
$('.foo').css('bottom', '100px');
Upvotes: 2