
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 DOM Style lineHeight Property
The HTML DOM Style lineHeight property is used to set the line height, which is the distance between the lines in a text.
Following is the syntax to set the lineHeight property −
object.style.lineHeight
Following is the syntax to return the lineHeight property −
object.style.lineHeight = "normal|number|length|%|initial|inherit"
Above, the values are described below −
- normal: Normal line height. Default.
- number: A number multiplied with the current font size to set the line height
- length: line height in length units
- %: line height in % of the current font size
- initial: Sets this property to its default value.
- inherit: Inherits this property from its parent element.
Let us now see an example to implement the DOM Style lineHeight property −
Example
<!DOCTYPE html> <html> <body> <h2>Demo Heading</h2> <div id="myid"> Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. Here, we have set demo text. </div> <br> <button type="button" onclick="display()">Click to increase the line height</button> <script> function display() { document.getElementById("myid").style.lineHeight = "3"; } </script> </body> </html>
Output
Now click the button to set the line height −
- Related Questions & Answers
- HTML DOM Style margin Property
- HTML DOM Style marginBottom Property
- HTML DOM Style marginTop Property
- HTML DOM Style marginLeft Property
- HTML DOM Style marginRight Property
- HTML DOM Style opacity Property
- HTML DOM Style padding Property
- HTML DOM Style paddingBottom Property
- HTML DOM Style paddingLeft Property
- HTML DOM Style outline Property
- HTML DOM Style outlineColor Property
- HTML DOM Style outlineWidth Property
- HTML DOM Style outlineStyle Property
- HTML DOM Style outlineOffset Property
- HTML DOM Style textAlign Property
Advertisements