Member-only story

CSS — Part-2

Eishta Mittal
3 min readMay 15, 2022

--

CSS Fonts

There are five generic font families:

  1. Serif
  2. Sans-serif
  3. Monospace
  4. Cursive
  5. Fantasy
.p1 {
font-family: "Times New Roman", Times, serif;
}
  • There is always a chance that a font is not found or is not installed properly.
  • Therefore, it is very important to always use fallback fonts.
  • Always end the list with a generic font family name.
p {
font-family: Tahoma, Verdana, sans-serif;
}

Font Style

  • font-style property is mostly used to specify italic text
  • Default value:normal
  • 3 values: — noraml, italic, oblique

Font Weight

  • specifies the weight of a font
  • Default value:normal
  • values: — normal, bold, bolder, lighter, 100–900

Font Variant

  • specifies whether or not a text should be displayed in a small-caps font
  • Default value:normal
  • values: normal, small-caps
<p class="normal">My name is Hege Refsnes.</p>
<p class="small">My name is Hege Refsnes.</p>E

Font Size

  • sets the size of the text

--

--

Eishta Mittal
Eishta Mittal

Written by Eishta Mittal

Software Engineer passionate about Frontend Engineering

No responses yet