Home  >  Article  >  Web Front-end  >  Introduction to jquery setting the height of a label element to the percentage of the screen

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

不言
不言Original
2018-07-02 14:52:411250browse

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!

Statement:
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