HTML DOM fontWeight ÊôÐÔ

HTML DOM Style ¶ÔÏó

¶¨ÒåºÍÓ÷¨

fontWeight ÊôÐÔÉèÖÃ×Ö·ûµÄ´Öϸ¡£

Óï·¨£º

Object.style.fontWeight=value

¿ÉÄܵÄÖµ

Öµ ÃèÊö
normal ĬÈÏ¡£¶¨Òå±ê×¼µÄ×Ö·û¡£
bold ¶¨Òå´ÖÌå×Ö·û¡£
bolder ¶¨Òå¸ü´ÖµÄ×Ö·û¡£
lighter ¶¨Òå¸üϸµÄ×Ö·û¡£
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
¶¨ÒåÓÉ´Öµ½Ï¸µÄ×Ö·û¡£400 µÈͬÓÚ normal£¬¶ø 700 µÈͬÓÚ bold¡£

ʵÀý

±¾Àý°ÑµÚÒ»¶ÎÉèÖÃΪ´ÖÌ壺

<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>

HTML DOM Style ¶ÔÏó

VUE