HTML CSS Reference/CSS Attributes and Javascript Style Properties/line height
Версия от 09:21, 26 мая 2010; (обсуждение)
Содержание
"line-height" Example
<html>
<body>
<p id="myP"
style="background-color:#EEEEEE">
This is the first line if a sample text.
<br>And this is its second line.
</p>
<input type="button"
value="Set lineHeight to 30px"
onclick="myP.style.lineHeight="30px"">
<input type="button"
value="Restore line height to normal"
onclick="myP.style.lineHeight="normal"">
<input type="button"
value="Restore line height to 50%"
onclick="myP.style.lineHeight="50%"">
</body>
</html>
"line-height" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <address> |
| |<b> <big> |
| |<blockquote> <body> |
| |<button> <caption> |
| |<center> <cite> |
| |<code> <col> |
| |<colgroup> currentStyle |
| |<custom> <dd> |
| |defaults <dfn> |
| |<dir> <div> |
| |<dl> <dt> |
| |<em> <fieldset> |
| |<form> <hn> |
| |<html> <i> |
| |<img> <input type="button"> |
| |<input type="checkbox"> <input type="file"> |
| |<inputtype="image"> <input type="password"> |
| |<input type="radio"> <input type="reset"> |
| |<input type="submit"> <input type="text"> |
| |<isindex> <kbd> |
| |<label> <legend> |
| |<li> <listing> |
| |<marquee> <menu> |
| |<ol> <p> |
| |<pre> runtimeStyle |
| |<s> <samp> |
| |<select> <small> |
| |<span> <strike> |
| |<strong> style |
| |<sub> <sup> |
| |<table> <tbody> |
| |<td> <textarea> |
| |<tfoot> <th> |
| |<thead> <tr> |
| |<tt> <u> |
| |<ul> <var> |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"line-height" Possible Values
Possible Values
normal The default
height A floating-point number followed by a unit designator
percentage Percentage of the height of the parent object
"line-height" Syntax and Note
Note:
Controls the line height.
Syntax:
element { line-height: value }
elementID.style.lineHeight = "value"
document.all.elementID.style.lineHeight = "value" // IE only