Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing font family in angular 4

I have written html code for an login page in (app.component.html) and it's css in (app.component.css),I want to import/use Open sans,font-family. I am bit confused by seeing different answers in various websites.Can u provide step-wise procedure to use Open sans font-family in angular 4?

like image 413
Shankar Avatar asked Jul 19 '18 04:07

Shankar


People also ask

How do I add fonts to my angular app?

Adding local fonts 1 Open the angular app in your favorite code editor. 2 Create a new folder called fonts inside the assets folder. 3 Download the fonts locally and place them in the fonts folder. 4 Open your style.css file and include the font by referencing a path. More ...

How to add oxygen font in angular app?

Open the angular app in your favorite code editor. Create a new folder called fonts inside the assets folder. Download the fonts locally and place them in the fonts folder. Open your style.css file and include the font by referencing a path. Here I added a Oxygen font. Now, you can use this font inside the components css files like this.

How to add a new font-face to a CSS file?

In my case src > assets > fonts > fontname > font-files (.woff). Then create a CSS file, src > assets > fonts > fonts-fontname.css. And on the CSS, add the font-face referring to our new font-flies, an example is given below.

How to add Roboto fonts in angular project?

Google font provides the following popular fonts. This post talks about adding Roboto fonts in the Angular project, The process for other fonts is the same. First, Go to Google fonts website and select the font you want to integrate In this example, I selected Roboto font as seen in the below screenshot.


1 Answers

2 Step Fix

Step - 1 : Insert the link in your index.html page

<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">

Step - 2 : Use it In your css file (Component.css)

* {
  font-family: 'Open Sans', sans-serif;
} 
like image 162
Debojyoti Avatar answered Nov 01 '22 18:11

Debojyoti