Tyilo
Tyilo

Reputation: 30102

Set bottom CSS property in JavaScript

How do I set the bottom CSS attribute of a node in JavaScript?

As in:

.foo
{
    position: absolute;
    bottom: 100px;
}

Upvotes: 1

Views: 1645

Answers (4)

Riz
Riz

Reputation: 10246

document.getElementsByClassName("foo").style.bottom = "100px";

jQuery recommended:

$('.foo').css('bottom', '100px');

Upvotes: 1

Sir Crispalot
Sir Crispalot

Reputation: 4844

yourObject.style.bottom="auto|length|%|inherit"

Taken from JavaScript and DOM reference here.

Upvotes: 3

rossipedia
rossipedia

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

Ariel
Ariel

Reputation: 26753

xxxxxx.style.bottom = "100px";

Upvotes: 2

Related Questions