【发布时间】:2015-01-27 16:02:39
【问题描述】:
我有一个 div 元素:
<div class="page">
//some contents
</div>
CSS:
.page{
bottom: 0;
color: #1f1f21;
font-size: 17px;
font-weight: 400;
left: 0;
overflow: visible;
position: absolute;
right: 0;
top: 0;
}
使用 JavaScript 获取屏幕高度:
var page_height = screen.height;
alert(page_height);
如何将此 page_height 值应用于我的 .page 类?
(即)我需要将屏幕高度设置为我的 page 类
例如,如果screen.height = 405
我需要添加高度属性
height: 405px;
【问题讨论】:
标签: javascript jquery html css