


The differences between scrollHeight, clientHeight and offsetHeight in various browsers
Document.body is the body node in the Document object in the DOM, and document.documentElement is a reference to the root node (html) of the document object.
The following content was tested under , all are personal test results~
The browser versions are: IE11, Firefox 53.0.3 (64-bit), chrome 58.0. 3029.110 (64-bit)
Test program js part code:
1.Comparison between document.documentElement.scrollHeight and document.body.scrollHeight
Under IE browser:
h1=document.documentElement.scrollHeight ; //The actual height of the content under the html tag, including the border, margin, and padding of the body tag;
h2=document.body.scrollHeight; //The actual height of the style including padding under the body tag, not Including the border and margin of the body tag;
Calculation result: h1=h2+upper and lower borders (borders of the body)+upper and lower margins (inner margins of the body);
Under Firefox browser:
h1= document.documentElement.scrollHeight; //The actual height of the content under the html tag, including the border, margin, and padding of the body tag;
h2=document.body.scrollHeight; //body The actual height of the style including padding under the tag, excluding the border and margin of the body tag;
Calculation result: h1=h2+upper and lower border (body's border) + upper and lower margin (body's inner margin);
// The calculation method is the same in both Firefox browser and IE browser. The calculation method in Chrome browser is slightly different.
Under Chrome browser:
h1=document.documentElement.scrollHeight; //The actual height of the content under the html tag, including the border, margin, and padding of the body tag;
h2=document.body.scrollHeight;
Calculation result: h1=h2;2.document.documentElement.clientHeight and document. Comparison of body.clientHeight
Under IE browser: h3=document.documentElement.clientHeight; //The height of the visible part of the web page content changes with the size of the browser window Changes with changes h4=document.body.clientHeight; Under Firefox browser: h3= document.documentElement.clientHeight; //The height of the visible part of the web page content changes with the change of the browser window size h4=document.body.clientHeight; //The actual height of the content under the body tag, including the padding of the body tag, excluding the border and margin of the body tag;/ / The calculation method is the same in both Firefox browser and IE browser. The calculation method in Chrome browser is slightly different.
Under Chrome browser:
h3=document.documentElement .clientHeight; //The height of the visible part of the web page content changes with the size of the browser window h4=document.body.clientHeight; //The actual height of the content under the body tag, including the body tag padding, excluding the border and margin of the body tag; 3.document.documentElement.offsetHeight and document.body.offsetHeight comparison
Under IE browser: h5=document.documentElement.offsetHeight; //The content under the html tag Actual height, including the border, margin, and padding of the body tag; h6=document.body.offsetHeight; //The actual height of the content under the body tag, including the border, padding of the body tag, excluding margin; Calculation result: h5=h6+margin(body tag);Firefox browser: h5=document.documentElement.offsetHeight; //Content under the html tag The actual height, including the border, margin, and padding of the body tag;h6=document.body.offsetHeight; //The actual height of the content under the body tag, including the border and padding of the body tag, excluding margin;
Calculation result: h5=h6+margin(body tag );
// The calculation method is the same in both Firefox browser and IE browser, but the calculation method of Chrome browser is slightly different
Chrome browser Bottom:
h5=document.documentElement.offsetHeight; //The actual height of the content under the html tag, including the border, margin, and padding of the body tag;
h6=document.body.offsetHeight; //The actual height of the content under the body tag, including the border and padding of the body tag, excluding margin;
Calculation result: h5=h6+margin (of the body tag);
The above three A browser, When the margin of the body tag is 0, h5=h6;
The above is the detailed content of The differences between scrollHeight, clientHeight and offsetHeight in various browsers. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

A detailed introduction to the login operation of the Sesame Open Exchange web version, including login steps and password recovery process. It also provides solutions to common problems such as login failure, unable to open the page, and unable to receive verification codes to help you log in to the platform smoothly.

This article introduces the registration process of the Sesame Open Exchange (Gate.io) web version and the Gate trading app in detail. Whether it is web registration or app registration, you need to visit the official website or app store to download the genuine app, then fill in the user name, password, email, mobile phone number and other information, and complete email or mobile phone verification.

Why can’t the Bybit exchange link be directly downloaded and installed? Bybit is a cryptocurrency exchange that provides trading services to users. The exchange's mobile apps cannot be downloaded directly through AppStore or GooglePlay for the following reasons: 1. App Store policy restricts Apple and Google from having strict requirements on the types of applications allowed in the app store. Cryptocurrency exchange applications often do not meet these requirements because they involve financial services and require specific regulations and security standards. 2. Laws and regulations Compliance In many countries, activities related to cryptocurrency transactions are regulated or restricted. To comply with these regulations, Bybit Application can only be used through official websites or other authorized channels

This article recommends the top ten cryptocurrency trading platforms worth paying attention to, including Binance, OKX, Gate.io, BitFlyer, KuCoin, Bybit, Coinbase Pro, Kraken, BYDFi and XBIT decentralized exchanges. These platforms have their own advantages in terms of transaction currency quantity, transaction type, security, compliance, and special features. For example, Binance is known for its largest transaction volume and abundant functions in the world, while BitFlyer attracts Asian users with its Japanese Financial Hall license and high security. Choosing a suitable platform requires comprehensive consideration based on your own trading experience, risk tolerance and investment preferences. Hope this article helps you find the best suit for yourself

It is crucial to choose a formal channel to download the app and ensure the safety of your account.

To access the latest version of Binance website login portal, just follow these simple steps. Go to the official website and click the "Login" button in the upper right corner. Select your existing login method. If you are a new user, please "Register". Enter your registered mobile number or email and password and complete authentication (such as mobile verification code or Google Authenticator). After successful verification, you can access the latest version of Binance official website login portal.

This guide provides detailed download and installation steps for the official Bitget Exchange app, suitable for Android and iOS systems. The guide integrates information from multiple authoritative sources, including the official website, the App Store, and Google Play, and emphasizes considerations during download and account management. Users can download the app from official channels, including app store, official website APK download and official website jump, and complete registration, identity verification and security settings. In addition, the guide covers frequently asked questions and considerations, such as

This guide provides detailed download and installation steps for the official Bitget Exchange app, suitable for Android and iOS systems. The guide integrates information from multiple authoritative sources, including the official website, the App Store, and Google Play, and emphasizes considerations during download and account management. Users can download the app from official channels, including app store, official website APK download and official website jump, and complete registration, identity verification and security settings. In addition, the guide covers frequently asked questions and considerations, such as
