fontWeight 属性设置字符的粗细。
</>code
- Object.style.fontWeight=value
值 | 描述 |
---|---|
normal | 默认。定义标准的字符。 |
bold | 定义粗体字符。 |
bolder | 定义更粗的字符。 |
lighter | 定义更细的字符。 |
|
定义由粗到细的字符。400 等同于 normal,而 700 等同于 bold。 |
本例把第一段设置为粗体:
</>code
- <html>
- <head>
- <script type="text/javascript">
- function setFontWeight()
- {
document.getElementById("p1").style.fontWeight="900";
- }
- </script>
- </head>
- <body>
- <p id="p1">This is an example paragraph.</p>
- <p>This is another example paragraph.</p>
- <input type="button" onclick="setFontWeight()"
- value="Display bold text" />
- </body>
- </html>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号