CSS Properties; CSS fonts(CSS Font Weight and CSS color

CSS Font Weight

The CSS font-weight is used to specify the thickness and boldness of an element's font. Simply, it defines the weight of the text. There is a difference in the available weight depending on the font family used by the browser.

Normal: This is the default font-weight with a numeric value of 400.

Lighter: This value considers the available font weight of the font family and makes it lighter than the original element.

Bolder: This value considers the available font weight of the font family and makes it heavier than the original element.

Bold: This value defines the bold font weight and has a numeric value of 700.

Number: This value sets the font-weight according to the stipulated number. It varies between 1 to 1000.

Initial: This is the value used to set the font-weight back to its default value.

Below is an example that illustrates the CSS font-weight.

<!DOCTYPE html>   
    <title> font-weight property example </title>   
            font-family: sans-serif;   
            font-weight: normal;   
            font-weight: lighter;   
            font-weight: bolder;   
            font-weight: bold;   
            font-weight: 1000;   
            font-weight: initial;   
            font-weight: inherit;   
            font-weight: unset;   
    <p class="one">   
       normal property value example
    <p class="two">   
      lighter property value example 
    <p class="three">   
      bolder property value example 
    <p class="four">   
      bold property value example 
   <p class="five">   
      number property value example 
    <p class="six">   
      initial property value example
    <p class="seven">   
      inherit property value example
    <p class="eight">   
      unset property value example 

CSS Color

CSS Font Weight Values

The CSS color property sets the HTML color elements. In most cases, this property is used to form an element's background color or font color.

The color values we use in CSS specify the color and allow border color and other decorative effects.

The following modes specify the color of an element:

RGB Format

This is an acronym for the 'RED GREEN and BLUE' format used to define the color of an HTML element by just specifying the values of R, G, and B that are in the range of 0 to 255. The color values of this format are specified using the rgb() property, allowing three values that can either be in percentage or integer (range from 0 to 255).

It is important to note that this property is not supported in every browser, so it is not advised to use it.

RGBA Format

This is identical to RGB format except that it contains A (Alpha), which defines an element's transparency. The value of A (Alpha) ranges between 0.0 to 1.0, in which 0.0 depicts fully transparent, and 1.0 depicts not transparent.

Hexadecimal Notation

Hexadecimal is a six-digit color illustration. The notation starts with the # symbol and is usually followed by six characters ranging from 0 to F. In a hexadecimal notation, RR is represented by the first pair of numbers, the second pair of numbers represents GG, and the third pair of numbers represents BB.

For example, the black color notation in hexadecimal is #000000, and the white color is #FFFFFF.

Short Hex codes

This is another form of hexadecimal notation in which each digit is recreated to produce an equivalent hexadecimal value. For example, #7B6 is the equivalent of #77BB66 in hexadecimal. It is shorter than a hexadecimal notation.

The black color notation in short hex is #000, and the white color notation in short hex is #FFF.


This is an acronym for Hue, Saturation, and Lightness.

Hue is the degree on the color wheel from 0 to 360. 0 means red, 120 means green, and 240 means blue.

Saturation takes value in percentage. 100% means fully saturated, i.e., no shades of gray, 50% means 50% gray, but the color is still seen, and 0% means fully unsaturated, i.e., completely gray, and the color is not. Lightness is the amount of light we wish to provide the color. 0% is black, depicting the absence of light, 50% is neither dark nor light, and 100% is white, showing total lightness.


This is quite similar to the HSL property. The only exception is its A (alpha), which specifies the transparency of an element. Its value ranges from 0.0 to 1.0, where 0.0 signifies fully transparent, and 1.0 signifies not transparent.

Built-in Color

The term built-in color refers to a collection of previously defined colors used by naming them something like red, blue, green, etc.

Below is the built-in colors list and their decimal and hexadecimal values.

S.no.Color nameHexadecimal ValueDecimal Value or rgb() value
        <title>CSS hsl color property example</title>   
              color: #E8E;  
        <h1 id="rgb">   
             Hello Developers. This is the RGB format example.  
        <h1 id="rgba">   
          Hello Developers. This is the RGBA format example.  
     <h1 id="hex">   
      Hello Developers. This is the Hexadecimal format example.  
 <h1 id="short">   
  Hello Developers. This is the Short-hex format example.  
 <h1 id="hsl">   
  Hello Developers. This is the HSL format example.  
<h1 id="hsla">   
  Hello Developers. This is the HSLA format example.  
<h1 id="built">   
  Hello Developers. This is the Built-in color format example.  
CSS Tutorial Quick Links