Applying a single font to an entire website with CSS

Michelle Smith picture Michelle Smith · Apr 6, 2012 · Viewed 194.1k times · Source

I want to use a single font named "Algerian" across my whole website. So, I need to change all HTML tags and I don't want to write different code for different tags like:

button{font-family:Algerian;}
div{font-family:Algerian;}

The method written below is also highly discouraged:

div,button,span,strong{font-family:Algerian;}

Answer

Jan Hančič picture Jan Hančič · Apr 6, 2012

Put the font-family declaration into a body selector:

body {
  font-family: Algerian;
}

All the elements on your page will inherit this font-family then (unless, of course you override it later).