How to Use Offline Font in CSS

In CSS we use Google fonts to style our website, but most of the developer wants to use font offline, we can use font offline in CSS by using their @font-face property. There are some following steps to use font offline:

Step1:  Open the following link:

Step2: Choose the Font Whatever you like and download it.

Step3:  After completing the download unzip the file and save it in your project folder.

Step4: In the CSS file write the following code:

@font-face {
  font-family: fontfamily; // you can write the name whatever you want
  src: url(foldername/font-name.ttf); // here write the font path and font name with its extension
font-family: fontfamilyname; // font family which you have created in your @font-face property.


<!DOCTYPE html>
@font-face {
  font-family: opansans;
  src: url(open-sans.ttf);
div {
  font-family: opensans;
<h1>Offline Font in CSS</h1>
<p> By Using CSS @font-face property we can use offline font very easily.</p>

Categories: web designing css

Trending Courses


Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing Expert Course

Regular : 6 Months

Fastrack : 3 Months

Crash : 2 Months

React JS

Regular : 45 Days

Fastrack : 25 Days

Crash : 15 Days


Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Front End Developer

Regular : 6 Months

Fastrack : 4 Months

Crash : 2 Months

Web Expert with Python

Regular : 12 Months

Fastrack : 6 Months

Crash : 3 Months

Related Blogs

Request For Demo