CSS फॉन्ट-वेट प्रॉपर्टी का उपयोग किसी तत्व के टेक्स्ट कैरेक्टर की बोल्डनेस को परिभाषित करने के लिए किया जाता है।
सिंटैक्स
CSS फॉन्ट-वेट प्रॉपर्टी का सिंटैक्स इस प्रकार है -
Selector {
font-weight: /*value*/
} उदाहरण
निम्नलिखित उदाहरण फ़ॉन्ट-भार गुण को दर्शाते हैं -
<!DOCTYPE html>
<html>
<head>
<style>
div {
margin: 3px;
font-family: "Ink Free";
width: 30%;
font-size: 24px;
}
#one {
font-weight: normal;
border-bottom: 2px dashed greenyellow;
}
#two {
font-family: "Kristen ITC";
font-weight: bolder;
border-bottom: 2px dashed cornflowerblue;
}
#three {
font-weight: bold;
border-bottom: 2px dashed chocolate;
}
</style>
</head>
<body>
<div id="one">First Demo Text</div>
<div id="two">Another Demo Text</div>
<div id="three">Last Demo Text</div>
</body>
</html> आउटपुट
यह निम्न आउटपुट देता है -

उदाहरण
<!DOCTYPE html>
<html>
<head>
<style>
[class|=lis] {
font-style: italic;
font-weight: bold;
}
li[class|="lis-ul"] {
background-color: cadetblue;
font-family: Helvetica;
font-weight: 100;
color: gainsboro;
width: 20%;
}
</style>
</head>
<body>
<h2>Tutorials</h2>
<ol>
<li><p>C#</li>
<li class="lis-ul-2">DBMS</li>
<li class="lis-3">OS</li>
<li>Java</li>
<ul>
<li class="lis-ul-one">Core Java</li>
<li class="lis">Advance Java</li>
</ul>
</ol>
</body>
</html> आउटपुट
यह निम्न आउटपुट देता है -
