Home > Web Front-end > JS Tutorial > body text

Introduction to jquery setting the height of a label element to the percentage of the screen

不言
Release: 2018-07-02 14:52:41
Original
1206 people have browsed it

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>
Copy after login

jquery part:

<script>
   $(function(){
       var percent =0.15; 
       $("#margin_box").css("height",window.document.body.clientHeight*percent)
   })
</script>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!