fontSize 属性设置元素的字体大小。
</>code
- Object.style.fontSize=value
值 | 描述 |
---|---|
|
把字体的尺寸设置为不同的尺寸,从 xx-small 到 xx-large。 默认值:medium。 |
smaller | 把 font-size 设置为比父元素更小的尺寸。 |
larger | 把 font-size 设置为比父元素更大的尺寸。 |
length | 把 font-size 设置为一个固定的值。 |
% | 把 font-size 设置为基于父元素的一个百分比。 |
本例改变文本的字体大小:
</>code
- <html>
- <head>
- <script type="text/javascript">
- function setFontSize()
- {
document.getElementById("p1").style.fontSize="larger";
- }
- </script>
- </head>
- <body>
- <p id="p1">This is an example paragraph.</p>
- <input type="button" onclick="setFontSize()"
- value="Change font-size" />
- </body>
- </html>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号