jQuery API | 返回首页目录 | jQuery API 中英文对照版 |
height(val) |
height(val) 为每个匹配的元素设置CSS高度(width)属性的值。如果没有明确指定单位(如:em或%),使用px。 返回值:jQuery 参数:
示例: $("p").height(20); HTML 代码: <p>This is just a test.</p> 结果: <p style="height:20px;">This is just a test.</p> 示例:$("p").height("20em"); HTML 代码: <p>This is just a test.</p> 结果: <p style="height:20em;">This is just a test.</p> height( val ) Set the CSS height of every matched element. If no explicit unit was specified (like 'em' or '%') then "px" is added to the width. Return value: jQuery
Example: $("p").height(20); Before: <p>This is just a test.</p>Result: <p style="height:20px;">This is just a test.</p> Example: $("p").height("20em"); Before: <p>This is just a test.</p>Result: <p style="height:20em;">This is just a test.</p>
|