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.

Custom font on webpage

Featured Replies

I am trying to use a custom font on a webpage rather than an image.

 

I downloaded a 'kit' from fontsquirrel and pasted the generated css into my existing css file. I then uploaded the actual font files (e.g. ttf) to a directory titled 'fonts' and edited the css to point at the full URL while the font files are located

 

I've referenced this in my index page, but the text is not appearing in the new font. I've attached a notepad file showing the section of the css I am talking about - can anyone point out where I am going wrong?

 

Thanks

 

 

My code.txt

You're missing a ' (apostrophe) before your AngelinaRegular in your @font-face code:

 

Your code...

@font-face {
    font-family: AngelinaRegular';
    src: url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.eot);
    src: url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.eot?#iefix) format('embedded-opentype'),
         url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.woff) format('woff'),
         url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.ttf) format('truetype'),
         url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.svg#angelinaregular) format('svg');
    font-weight: normal;
    font-style: normal;

}

 

 

Should be...

 


@font-face {
    font-family: 'AngelinaRegular';
    src: url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.eot);
    src: url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.eot?#iefix) format('embedded-opentype'),
         url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.woff) format('woff'),
         url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.ttf) format('truetype'),
         url(http://www.mysite.co.uk/testing/fonts/angelina-webfont.svg#angelinaregular) format('svg');
    font-weight: normal;
    font-style: normal;

}

Edited by Alluziion

  • Author

Thanks for the reply. I've corrected this but still have the same problem

Okay... try this instead

#content2 {
	height:65%;
	width:65%;					/* Edited when right nav removed */
	margin:20px 0px 0px 0px;	/* Space after logo before content starts  Changed bottom to 0 after social media*/
	text-align:left;
	font-family: 'AngelinaRegular';
    font-weight: normal;
    font-style: normal;
	color:#000000;
}

@font-face {
    font-family: 'AngelinaRegular';
    src: url('http://www.mysite.co.uk/testing/fonts/angelina-webfont.eot');
    src: url('http://www.mysite.co.uk/testing/fonts/angelina-webfont.eot?#iefix') format('embedded-opentype'),
         url('http://www.mysite.co.uk/testing/fonts/angelina-webfont.woff') format('woff'),
         url('http://www.mysite.co.uk/testing/fonts/angelina-webfont.ttf') format('truetype'),
         url('http://www.mysite.co.uk/testing/fonts/angelina-webfont.svg#angelinaregular') format('svg');
    font-weight: normal;
    font-style: normal;

}
  • Author

Thanks for your help, but it is still not working - any other thoughts?

It could be a number of things:

 

  • Your file path is incorrect (I tend to store my fonts in a folder called 'fonts' and use the following in my stylesheet ../fonts/ instead of the website URL.
  • Your server does not support the mime types required for @font-face (http://stackoverflow.com/questions/3594823/mime-type-for-woff-fonts as an example).
  • You are not targeting the correct element in your CSS. Try using H1 as a selector instead of #content2 (
  • h1 { font-family: 'AngelinaRegular';}
  • ).
  • Your issue could be browser specific, have you tested in a few?

Alternatively take a look at http://www.fontsquirrel.com/blog/2010/11/troubleshooting-font-face-problems.

  • Author

Thanks, managed to resolve this now using relative paths

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.