Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying a single font to an entire website with CSS

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;} 
like image 307
Michelle Smith Avatar asked Apr 06 '12 09:04

Michelle Smith


People also ask

How do I use the same font on a whole website?

Two options there: use @font-face if your font is free of use as a downloadable font or add fallback(s): a second, a third, etc and finally a default family (sans-serif, cursive (*), monospace or serif). The first of the list that exists on the OS of the user will be used.

How do I apply a font to all HTML?

You can use a <basefont> tag to set all of your text to the same size, face, and color.

How do you set a default font on a website?

Scroll down until you get to the “Web Content” section and click on “Customize fonts.” Alternatively, you can just enter chrome://settings/fonts into your browser and hit “Enter.” Now you can change all your font settings.


1 Answers

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).

like image 54
Jan Hančič Avatar answered Sep 18 '22 06:09

Jan Hančič