css获取整个页面高度

html-css018

css获取整个页面高度,第1张

Js获取高度:

网页可见区域高:document.body.clientHeight

网页可见区域高:document.body.offsetHeight (包括边线的宽)

网页正文全文高:document.body.scrollHeight

网页被卷去的高:document.body.scrollTop

屏幕分辨率的高:window.screen.height

屏幕可用工作区高度:window.screen.availHeight

你想在CSS中写肯定是不行的。你可以试一下,在Css中连1+1都不能算。

你要是想实现这个可以用JS

网页可见区域高:document.body.clientHeight

网页可见区域高:document.body.offsetHeight (包括边线的宽)

在Body标签里onsize=“yourfun()”

js里:

function yourfun()

{

用document.body.clientHeight取得高度

算出宽度后赋值给div就可以了

}