Html中如何操作頁面、可視區(qū)、屏幕等寬高屬性

這篇文章主要介紹Html中如何操作頁面、可視區(qū)、屏幕等寬高屬性,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!

站在用戶的角度思考問題,與客戶深入溝通,找到杭錦后網(wǎng)站設(shè)計與杭錦后網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都做網(wǎng)站、網(wǎng)站設(shè)計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、域名注冊、虛擬主機、企業(yè)郵箱。業(yè)務(wù)覆蓋杭錦后地區(qū)。

關(guān)于頁面、可視區(qū)、屏幕等一些相關(guān)的寬高屬性

function size(){
	document.write(
	"屏幕分辨率為:"+screen.width+"*"+screen.height
	+"<br />"+
	"屏幕可用大?。?quot;+screen.availWidth+"*"+screen.availHeight
	+"<br />"+
	"網(wǎng)頁可見區(qū)域?qū)挘?quot;+document.body.clientWidth
	+"<br />"+
	"網(wǎng)頁可見區(qū)域高:"+document.body.clientHeight
	+"<br />"+
	"瀏覽器窗口寬:"+document.documentElement.clientWidth
	+"<br />"+
	"瀏覽器窗口高:"+document.documentElement.clientHeight
	+"<br />"+
	"html所有元素寬:"+document.documentElement.offsetWidth
	+"<br />"+
	"html所有元素高:"+document.documentElement.offsetHeight
	+"<br />"+
	"網(wǎng)頁可見區(qū)域?qū)?包括邊線的寬):"+document.body.offsetWidth 
	+"<br />"+
	"網(wǎng)頁可見區(qū)域高(包括邊線的寬):"+document.body.offsetHeight 
	+"<br />"+
	"網(wǎng)頁正文全文寬:"+document.body.scrollWidth
	+"<br />"+
	"網(wǎng)頁正文全文高:"+document.body.scrollHeight
	+"<br />"+
	"網(wǎng)頁被卷去的高:"+document.body.scrollTop
	+"<br />"+
	"網(wǎng)頁被卷去的左:"+document.body.scrollLeft
	+"<br />"+
	"網(wǎng)頁正文部分上:"+window.screenTop
	+"<br />"+
	"網(wǎng)頁正文部分左:"+window.screenLeft
	+"<br />"+
	"屏幕分辨率的高:"+window.screen.height
	+"<br />"+
	"屏幕分辨率的寬:"+window.screen.width
	+"<br />"+
	"屏幕可用工作區(qū)高度:"+window.screen.availHeight
	+"<br />"+
	"屏幕可用工作區(qū)寬度:"+window.screen.availWidth
	);
}

補充下,關(guān)于html dom元素都有一些關(guān)于位置,尺寸大小的屬性,如下

offsetWidth

clientWidth

scrollWidth

offsetHeight

clientHeight

scrollHeight

offsetLeft

clientLeft

scrollLeft

offsetTop

clientTop

scrollTop

1. clientHeight和clientWidth用于描述元素內(nèi)尺寸,是指 元素內(nèi)容+內(nèi)邊距 大小,不包括邊框(IE下實際包括)、外邊距、滾動條部分

2. offsetHeight和offsetWidth用于描述元素外尺寸,是指 元素內(nèi)容+內(nèi)邊距+邊框,不包括外邊距和滾動條部分

3. clientTop和clientLeft返回內(nèi)邊距的邊緣和邊框的外邊緣之間的水平和垂直距離,也就是左,上邊框?qū)挾?/p>

4. offsetTop和offsetLeft表示該元素的左上角(邊框外邊緣)與已定位的父容器(offsetParent對象)左上角的距離

以上是Html中如何操作頁面、可視區(qū)、屏幕等寬高屬性的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)站題目:Html中如何操作頁面、可視區(qū)、屏幕等寬高屬性
轉(zhuǎn)載來于:http://bm7419.com/article6/gocdig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計公司面包屑導(dǎo)航、App設(shè)計、網(wǎng)站制作網(wǎng)站設(shè)計公司、移動網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)