Quantcast
Channel: User totymedli - Stack Overflow
Viewing all articles
Browse latest Browse all 54

Answer by totymedli for How to add "Ubuntu Font Family" to my site using CSS?

$
0
0

Importing the font

First, you have to make sure, your site has that font in case the average user who visits your site doesn't have it.

Option 1 - Import from external provider

You can import the whole font file and settings from an external font host like Google Fonts. Just add this code to your HTML to import it:

<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin">

Option 2 - Store it in your server

You can download then upload the font files to your server, then import them via @font-face in your CSS. In this example the place of your font file will be http://example.com/fonts/ubuntu.woff.

@font-face {    font-family: 'Ubuntu';    font-style: normal;    font-weight: 400;    src: local('Ubuntu'), url(http://example.com/fonts/ubuntu.woff) format('woff');}

Using the font

You have to specify where do you want to use that font. Just add Ubuntu to your font-family list:

body {    font-family: Ubuntu, "times new roman", times, roman, serif;}

This example code will make the Ubuntu font the default font for every text in your entire web page unless it is overriden by a more specific CSS rule.


Viewing all articles
Browse latest Browse all 54

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>