Ammar Tavakoli
Ammar Tavakoli

Reputation: 3

Don't apply font-family on text

I've used a font-family in css, but the font-family doesn't apply on text on the server. I've applyed the font-family as follows:

@font-face {
  font-family: "SultanAdan";
  font-style: normal;
  font-weight: normal;
  src: url("/WebsiteFiles/FontsSultanAdanBold.otf")format("opentype"),url("/WebsiteFiles/Fonts/SultanAdanBold.woff") format("woff"),url("/WebsiteFilesFontsSultanAdanBold.ttf")format("truetype"), url("/WebsiteFiles/Fonts/SultanAdanBold.svg")format("svg");
}

Upvotes: 0

Views: 235

Answers (1)

Nmk
Nmk

Reputation: 1321

This is the method with the deepest support possible right now. The @font-face rule should be added to the stylesheet before any styles.

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

Then use it to style elements like this:

body {
  font-family: 'MyWebFont', Fallback, sans-serif;
}

Upvotes: 1

Related Questions