
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Font Weight in CSS
The CSS font-weight property is used to define the boldness of text characters of an element.
Syntax
The syntax of CSS font-weight property is as follows −
Selector { font-weight: /*value*/ }
Example
The following examples illustrate font-weight property −
<!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>
Output
This gives the following output −
Example
<!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>
Output
This gives the following output −
- Related Questions & Answers
- Set the font weight with CSS
- Usage of font-weight property in CSS
- Perform Animation on CSS font-weight property
- Bold font weight for LaTeX axes label in Matplotlib
- Font Properties in CSS
- Font Family in CSS
- Font Size in CSS
- Font Style in CSS
- Font Variant in CSS
- CSS font-kerning Property
- CSS font-variant Property
- CSS font-size-adjust Property
- Usage of font property in CSS
- Usage of font-variant property in CSS
- Usage of font-style property in CSS
Advertisements