1

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

As in:

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

4 Answers 4

3

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

Taken from JavaScript and DOM reference here.

Sign up to request clarification or add additional context in comments.

Comments

2
xxxxxx.style.bottom = "100px";

Comments

2

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');

1 Comment

-1 why exactly would you require a huge js library , just for doing something like this .. its stupid. And how exactly would it be differ by browser ?!
1
document.getElementsByClassName("foo").style.bottom = "100px";

jQuery recommended:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.