Home >Web Front-end >JS Tutorial >Introduction to jquery setting the height of a label element to the percentage of the screen
This article mainly introduces js to set the height of the label element to the percentage of the screen. Friends who need it can refer to the
html part:
<body> <p id="margin_box"></p> </body>
jquery part:
<script> $(function(){ var percent =0.15; $("#margin_box").css("height",window.document.body.clientHeight*percent) }) </script>
The above is the entire content of this article. I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
How to load navigation history when using jQuery mobile class library
Simple method based on JSON format data Introduction to jQuery slide plug-in (jquery-slider)
The above is the detailed content of Introduction to jquery setting the height of a label element to the percentage of the screen. For more information, please follow other related articles on the PHP Chinese website!