- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML Screen height Property
The HTML Screen height property returns the total height of the user’s screen.
Syntax
Following is the syntax −
screen.height
Example
Let us see an example of HTML Screen height Property -
<!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; background-color: #FBAB7E; background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%); text-align: center; } .btn { background: #db133a; border: none; height: 2rem; border-radius: 2px; width: 40%; display: block; color: #fff; outline: none; cursor: pointer; margin: 1rem auto; } .show { font-size: 1.2rem; margin: 1rem auto; font-weight: bold; font-family: sans-serif; } </style> <body> <h1>HTML screen height Property</h1> <button class="btn" onclick="get()">Show Screen Height</button> <div class="show"></div> <script> function get() { document.querySelector(".show").innerHTML = "Total height is " + screen.height + "px"; } </script> </body> </html>
Output
Click on “Show Screen Height” button to display total height of user’s screen −
- Related Articles
- HTML Screen availHeight Property
- HTML Screen availWidth Property
- HTML Screen width Property
- HTML Screen colorDepth Property
- HTML Screen pixelDepth Property
- HTML DOM Object Height Property
- HTML DOM Style height Property
- HTML DOM Video height Property
- How to make the web page height to fit screen height with HTML?
- How to make the main content div fill height of screen with CSS and HTML
- CSS height property
- HTML height Attribute
- How can I get android device screen height, width?
- CSS line-height property
- CSS max-height property

Advertisements