Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Best way to load external font in html

Featured Replies

hello...

i want to know that how can i load external fonts in my website...

and want to know bit more about font format and their uses in diffrent devices

http://www.google.com/fonts is the most popular method nowadays, but generally speaking (including JS, @font and standard methods):

 

@font-face { font-family: FontName; src: url('/path/to/font.otf'); }

Edited by PipeTenHostingCarl

If you want your own fonts on your site you need to read about:

 

  • CSS 3
  • Font-face
  • Woff format and SVG fonts
  • CSS 3 compatibility

As for why some of those fonts don't load, check if you uploaded the files to your server with the correct path and with the correct permissions (owner can read and write, group and users can only read), so that the server can send them to the viewer's computer.

First create a reference to the font make sure you have all the formats (different browsers uses different formats) and that the path is correct. In the font-family property you specify the rerference name you want to use (you can use any name you like but it makes sense to use the font name)

 

CSS:

@font-face {
font-family: 'League Gothic';
src: url('fonts/leaguegothic-regular-webfont.eot');
src: url('fonts/leaguegothic-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/leaguegothic-regular-webfont.woff') format('woff'),
url('fonts/leaguegothic-regular-webfont.ttf') format('truetype'),
url('fonts/leaguegothic-regular-webfont.svg#league_gothicregular') format('svg');
font-weight: normal;
font-style: normal;
}

Now you can reference the font just like a websafe font on any element.

 

CSS:

h1 {
     font-family: 'League Gothic';
}

I always first look for the font on a CDN such as Google web fonts.

 

If I cannot find it there I will use Font Squirrel to generate the necessary font types (e.g: .woff, .eot etc) and Font Squirrel will also generate the CSS needed to load the fonts. It works with all browsers including IE8. I have not tested with IE7 and below as I won't develop in these almost antique browsers.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.