First, let's take a look at the relative length units of CSS3 (refer to the detailed tutorial): Relative length units specify the property of one length relative to another length. Relative lengths are more applicable to different devices.
It can be seen that through vh / vw we can get the current screen window width, so in CSS, by calculating this height, the height of the div can be automatically expanded to the screen height. To calculate this height, you can use the calc() function of CSS3 (refer to the detailed tutorial): The calc() function is used to dynamically calculate the length value.
So, just set the height of the div to calc(100vh) , 100vh = 100% of the window height, example: div { width: 100%; height: calc(100vh); } It should be noted that this method is suitable for the web page height being equal to the current screen window height, and JS may still be required according to actual needs. This is the end of this article about how to use calc() in CSS to get the current visible screen height. For more information about how to use calc() in CSS to get the current screen height, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Discuss the value of Web standards from four aspects with a mind map
>>: Some simple implementation codes of the form element take registration as an example
<br />This is from the content of Web front-...
Trident core: IE, MaxThon, TT, The World, 360, So...
The shutdown.bat file has a sentence if not "...
CocosCreator version 2.3.4 Dragon bone animation ...
6 solutions for network failure in Docker contain...
Table of contents Preface Idea startup speed Tomc...
Table of contents 1. Introduction 2. On-demand at...
Comprehensive Documentation github address https:...
question: When developing the Alice management sy...
This article shares with you the installation tut...
Are you still using rem flexible layout? Does it ...
JavaScript clothing album switching effect (simil...
<body> <div id="root"> <...
Basic Concepts Absolute positioning: An element b...
With the popularity and maturity of Docker, it ha...