Curriculum
Course: CSS
Login

Curriculum

CSS

CSS INTRODUCTION

0/1

CSS Selectors

0/1

CSS Comments

0/1

CSS Padding

0/1

CSS Box Model

0/1

CSS Combinators

0/1

CSS Pseudo-classes

0/1

CSS Pseudo-elements

0/1

CSS Dropdowns

0/1

CSS Image Gallery

0/1

CSS Image Sprites

0/1

CSS Counters

0/1

CSS Website Layout

0/1

CSS Specificity

0/1

CSS Math Functions

0/1
Text lesson

Font Property

The CSS Font Property

To reduce code length, you can consolidate all individual font properties into a single property declaration.

The font property serves as a shorthand for:

  • font-style
  • font-variant
  • font-weight
  • font-size/line-height
  • font-family

Note: While specifying font-size and font-family is mandatory, if any other value is omitted, the default values are applied.

Example

Utilize the font shorthand property to consolidate multiple font attributes into a single declaration.

p.a {
  font: 20px Arial, sans-serif;
}

p.b {
  font: italic small-caps bold 12px/30px Georgia, serif;
}

All CSS Font Properties

Property

Description

font

Consolidates all font properties into a single declaration.

font-family

Defines the font family for text.

font-size

Define the font size of text

font-style

Define the font style for text

font-variant

Determines whether text should be displayed in a small-caps font.

font-weight

Specifies the font weight.