简体   繁体   English

在JavaScript中设置底部CSS属性

[英]Set bottom CSS property in JavaScript

How do I set the bottom CSS attribute of a node in JavaScript? 如何在JavaScript中设置节点的底部CSS属性?

As in: 如:

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

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

从JavaScript和DOM取出的参考这里

xxxxxx.style.bottom = "100px";

Depends. 要看。 In raw javascript, it will be a little different by browser. 在原始javascript中,浏览器会有所不同。 The easiest way to do that is to use something like jQuery , and then it's as easy as: 最简单的方法是使用jQuery之类的东西,然后变得简单:

$('.foo').css('bottom', '100px');
document.getElementsByClassName("foo").style.bottom = "100px";

jQuery推荐:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM