• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Css Basic: font-weight

December 20, 2023

CSS Basics: font-weight

In the world of web design, CSS (Cascading Style Sheets) plays a crucial role in determining the visual appearance of a website. One of the fundamental properties of CSS is font-weight, which allows designers to control the thickness or boldness of text. In this article, we will explore the various aspects of font-weight and how it can be used effectively in web design.

Understanding font-weight

The font-weight property is used to specify the weight or thickness of the text characters. It accepts different values ranging from 100 to 900, with 400 being the default value. The higher the value, the bolder the text appears. However, not all font families support all the available weights. Some fonts may only have a few specific weights, while others may have a wide range of options.

Using font-weight in CSS

To apply font-weight to an element in CSS, you can use either the numerical value or the predefined keywords. Here are some examples:

p {
  font-weight: 400; /* Using numerical value */
}

h1 {
  font-weight: bold; /* Using predefined keyword */
}

h2 {
  font-weight: 700; /* Using numerical value */
}

In the above example, the p element will have a normal font weight, while the h1 element will be bold, and the h2 element will have a heavier font weight.

Common font-weight values

Here are some commonly used font-weight values:

  • normal: The default font weight (equivalent to 400)
  • bold: A bold font weight (equivalent to 700)
  • bolder: A font weight that is bolder than the parent element
  • lighter: A font weight that is lighter than the parent element

It’s important to note that the actual appearance of the text may vary depending on the font family being used. Some fonts may have subtle differences in their boldness, while others may have distinct variations.

Combining font-weight with other CSS properties

The font-weight property can be combined with other CSS properties to create visually appealing text styles. For example, you can use it in conjunction with font-size to create headings with different weights and sizes:

h1 {
  font-size: 24px;
  font-weight: bold;
}

h2 {
  font-size: 20px;
  font-weight: 700;
}

In the above example, the h1 heading will have a larger font size and a bold font weight, while the h2 heading will have a slightly smaller font size and a heavier font weight.

Conclusion

The font-weight property in CSS is a powerful tool for controlling the thickness or boldness of text. By understanding how to use this property effectively, web designers can create visually appealing and well-structured websites. Experiment with different font weights and combinations to find the perfect balance for your website’s typography.

For more information on VPS hosting and other web hosting solutions, visit Server.HK.

Recent Posts

  • How to Deploy a Node.js Application on Hong Kong VPS: Complete Guide
  • How to Set Up a WordPress Site on a Hong Kong VPS with aaPanel (Step-by-Step 2026)
  • How to Choose the Right Hong Kong VPS Plan: A Buyer’s Guide for 2026
  • CN2 GIA vs BGP vs CN2 GT: What’s the Real Difference for China Connectivity?
  • Top 5 Use Cases for a Hong Kong Dedicated Server in 2026

Recent Comments

No comments to show.

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot