Javascript examples for CSS Style Property:lineHeight
The lineHeight property sets or gets the distance between lines.
Value | Description |
---|---|
normal | Normal line height is used. This is default |
number | A number to be multiplied with the current font size to set the line height |
length | line height in length units |
% | line height in percentage of the current font size |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | normal? |
Return Value: | A String, representing the distance between lines in the text |
CSS Version | CSS1 |
Set the line height for a <div> element:
<!DOCTYPE html> <html> <body> <div id="myDiv" style="line-height:450%;"> This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </div>/*from ww w. j a v a2 s . c om*/ <button type="button" onclick="myFunction()">Get line height</button> <script> function myFunction() { document.getElementById("myDiv").style.lineHeight = '20px'; } </script> </body> </html>