How To Use @font-face

Step #1 : Download the font

Find the custom font that you want to add to your website and download it. The file extension should be either .ttf or .svg or .otf.

Find fonts you can download for free at: fonts2u, fontpro


Step #2 : Generate formats for cross-browsing

Different browsers support different font formats, to add a custom font to a website and to have it correctly displayed on every browser, you have to generate several formats for your font.

For example:

Internet Explorer (all versions) – .EOT;

Safari (3.2+) – .TTF / .OTF;

iPhone (3.1) – .SVG;

Chrome (all versions) – .SVG (.TTF/.OTF added 25th Jan 2010);

Firefox (3.5+) – .TTF/.OTF (.WOFF added 3.6);

Opera (10+) – .TTF/.OTF.

To get all the file extensions, we can use Font Face generator.

Link: Font Face Generator


Step #3 : Upload font files on your website

After generating all files using FTP or file manager to upload all fonts on your website; inside the styling folder /css, create a folder and name it fonts.


Step #4 : Add your custom font files into CSS

To add custom fonts to the website using @font-face at-rule (one @font-face for each font family), just add the following code at the top of the main styling page, or whichever css file that will use the font-face, usually it is saved as style.css

The code has src attribute and its two values, the url which accepts a local path to the font file and the second value is the format which accepts the extension of the file, e.g format(“svg”).

@font-face {

font-family: “Harabara Bold”;

src: url(“css/fonts/Harabara.eot”); // the local path to the font

src:

url(“css/fonts/Harabara.woff”) format(“woff”),

url(“css/fonts/Harabara.otf”) format(“opentype”),

url(“css/fonts/Harabara.svg#filename”) format(“svg”);

}


Step #5 : Start working

Now the custom font is added to the website and ready to be used like so :

h1 {

font-family: ‘Harabara Bold’; // like this

font-weight:normal;

font-style:normal;

}


We are done with @font-face, but if you wonder what’s the deal with the @ at the beginning of the word ‘font-face’ – read on.

The @ is there because @font-face is a CSS at-rule.

An at-rule is a CSS statement beginning with an at sign, ‘@‘ (U+0040 COMMERCIAL AT), followed by an identifier and includes everything up to the next semi-colon, ‘;‘ (U+003B SEMICOLON), or the next CSS block, whichever comes first.

There are several at-rules, designated by their identifiers, each with a different syntax:

@charset — Defines the character set used by the style sheet.

@import — Tells the CSS engine to include an external style sheet.

@namespace — Tells the CSS engine that all its content must be considered prefixed with an XML namespace.

 

Nested at-rules

A subset of nested statements, which can be used as a statement of a style sheet as well as inside of conditional group rules:

@media — A conditional group rule that will apply its content if the device meets the criteria of the condition defined using a media query.

@supports — A conditional group rule that will apply its content if the browser meets the criteria of the given condition.

@document — A conditional group rule that will apply its content if the document in which the style sheet is applied meets the criteria of the given condition. (deferred to Level 4 of CSS Spec)

@page — Describes the aspect of layout changes that will be applied when printing the document.

@font-face — Describes the aspect of an external font to be downloaded.

@keyframes — Describes the aspect of intermediate steps in a CSS animation sequence.

@viewport — Describes the aspects of the viewport for small screen devices. (currently at the Working Draft stage)

@counter-style — Defines specific counter styles that are not part of the predefined set of styles. (at the Candidate Recommendation stage, but only implemented in Gecko as of writing)

@font-feature-values (plus @swash, @ornaments, @annotation, @stylistic, @styleset and @character-variant)
— Define common names in font-variant-alternates for feature activated differently in OpenType. (at the Candidate Recommendation stage, but only implemented in Gecko as of writing)

 

138 Comments

  1. 720p December 19, 2020 at 5:31 pm

    Pretty! This has been an extremely wonderful article. Thank you for supplying this information. Clementine Hale Dorman

  2. yabanci December 19, 2020 at 8:35 pm

    I like it when folks get together and share thoughts. Great website, keep it up. Ansley Morie Baker

  3. 720p December 19, 2020 at 10:21 pm

    If you wish for to get much from this article then you have to apply these methods to your won webpage. Nichol Taber Sella

  4. altyazili December 19, 2020 at 11:48 pm

    We came across a cool internet site that you just may enjoy. Take a appear should you want. Dyanna Filberte Gabriel

  5. yabanci December 20, 2020 at 1:07 am

    Some truly interesting details you have written. Aided me a lot, just what I was searching for :D. Aridatha Neron Reedy

  6. sikis izle December 20, 2020 at 3:35 am

    Download this e-guide to be taught methods that can make your deal with coaching more effective. Roda Wallas Angelis

  7. bedava December 20, 2020 at 5:11 am

    Say, you got a nice article post. Really thank you! Want more. Brynna Towney Durham

  8. download December 23, 2020 at 6:36 am

    I visited several web sites however the audio feature for audio songs present at this web site is in fact wonderful. Laverna Rayner Ames

  9. torrent December 23, 2020 at 8:29 am

    Really informative blog article. Really looking forward to read more. Really Great. Gilbertina Culley Lai

  10. ucretsiz December 23, 2020 at 10:14 am

    Wow! In the end I got a web site from where I be able to genuinely take valuable facts regarding my study and knowledge. Mireielle Gawen Fablan

  11. yify December 23, 2020 at 11:48 am

    This article is genuinely a good one it helps new web people, who are wishing in favor of blogging. Elvira Hubie Konstance

  12. bedava December 24, 2020 at 3:54 am

    There is certainly a great deal to learn about this issue. I love all of the points you made. Madge Nikki Bea

  13. web-dl January 11, 2021 at 10:00 pm

    What a data of un-ambiguity and preserveness of valuable know-how concerning unpredicted feelings. Mozelle Otis Woodhouse

  14. bluray January 23, 2021 at 12:41 pm

    Regards for helping out, fantastic information. Benetta Harald Paviour

  15. BradTMarolda January 24, 2021 at 10:05 pm

    I would like to to many thanks for this good read!!
    I definitely loved every small amount of it. I actually have got
    you book-marked to look at new things you post

    Feel free to surf to my webpage – BradTMarolda

  16. avengers endgame izle January 29, 2021 at 2:58 pm

    I am sure this paragraph has touched all the internet viewers, its really really good post on building up new web site. Veradis Shelton Farrison

  17. online January 30, 2021 at 12:40 am

    Hello, after reading this awesome paragraph i am too cheerful to share my knowledge here with colleagues. Marylynne Noble Knighton

  18. altyazili February 1, 2021 at 8:25 am

    As the admin of this web page is working, no uncertainty very quickly it will be well-known, due to its quality contents.| Roby Vincents Scrogan

  19. 720p February 6, 2021 at 12:42 pm

    what makes Fioricet helps in dealing with anxiety and stress Opalina Bondon Beebe

  20. online February 7, 2021 at 3:03 am

    I was curious if you ever considered changing the page layout of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or 2 pictures. Maybe you could space it out better? Frannie Ruddy Aurora

  21. yabanci February 7, 2021 at 8:08 am

    den sjokoladeglasuren, blir det veldig mye med 1 pk Melis, at det blir for mye for kun muffins?? Regan Kerby Fidelio

  22. watch February 7, 2021 at 9:05 am

    just beneath, are numerous totally not connected internet sites to ours, however, they may be certainly really worth going over Jennie Andrus Conrado

  23. altyazili February 7, 2021 at 10:56 am

    A a imprint at a occasion down from line formal, apply to mavin clothing is tranquillizing deft, dyed in the wool, and set, if a elegant more forth when it comes to sladen.casseo.se/smukt-hus/1960-tjstil.php color or pattern. Asseveration businesslike is also again called unwritten business. Obviate to present a ceremonious alertness procedure, injecting oneness into your outfits with your accessories and color choices. Ivett Craggie Kayla

  24. altyazili February 7, 2021 at 3:00 pm

    I have been checking out a few of your articles and i must say clever stuff. I will surely bookmark your blog. Gabrielle Fonsie Julis

  25. watch February 7, 2021 at 4:14 pm

    You have made some good points there. I checked on the net for more information about the issue and found most people will go along with your views on this site. Carley Lyman Uno

  26. bluray February 7, 2021 at 5:35 pm

    After all, we should remember compellingly reintermediate mission-critical potentialities whereas cross functional scenarios. Phosfluorescently re-engineer distributed processes without standardized supply chains. Quickly initiate efficient initiatives without wireless web services. Interactively underwhelm turnkey initiatives before high-payoff relationships. Holisticly restore superior interfaces before flexible technology. Berta Cletis Kaine

  27. WyattELavery February 8, 2021 at 1:02 pm

    I love your site.. good colors & theme. Did you design this site yourself or would you hire someone to make it
    happen for you? Plz respond as I’m looking to create my very own blog and would like to discover where u got this from.
    thanks

    Also visit my webpage :: WyattELavery

  28. turkce February 9, 2021 at 9:02 pm

    If you are going for finest contents like I do, simply go to see this site every day since it provides quality contents, thanks Isadora Wells Stoecker

  29. 720p February 9, 2021 at 10:31 pm

    Thanks so much for this list! Definitely want to look into some of these resources. Donetta Jude Connell

  30. diziler February 10, 2021 at 7:57 am

    Once I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any method you may remove me from that service? Thanks! Eleonore Arte Dunaville

  31. 1080p February 10, 2021 at 11:27 am

    Hey there. I discovered your website by means of Google even as looking for a related subject, your site came up. It looks great. I have bookmarked it in my google bookmarks to visit then. Kelsy Raviv Roselia

  32. bedava February 10, 2021 at 4:04 pm

    Est enim effectrix multarum et magnarum voluptatum. Si alia sentit, inquam, alia loquitur, numquam intellegam quid sentiat; Et nunc quidem quod eam tuetur, ut de vite potissimum loquar, est id extrinsecus; Ut optime, secundum naturam affectum esse possit. Cory Maurie Feucht

  33. online February 10, 2021 at 5:27 pm

    Good post. I absolutely love this website. Thanks! Natalina Vaclav Idalia

  34. 720p February 10, 2021 at 8:45 pm

    It is actually a great and helpful piece of information. I am satisfied that you shared this helpful info with us. Please keep us up to date like this. Thanks for sharing. Tessy Agustin Huoh

  35. erotik February 11, 2021 at 4:21 pm

    Hello my family member! I wish to say that this post is awesome, nice written and come with approximately all vital infos. I would like to see more posts like this . Jorry Jules Meave

  36. Fqbbhergy February 13, 2021 at 9:06 pm

    merchant category cash advances-financial inst manual cash disbursements cash loans 800 cash advance my credit card

  37. Headache drugs over the counter February 14, 2021 at 4:47 pm

    Thanks for your suggestions. One thing I’ve noticed is the fact that banks as well as financial institutions really know the spending routines of consumers as well as understand that many people max out their credit cards around the vacations. They sensibly take advantage of this particular fact and start flooding your own inbox as well as snail-mail box along with hundreds of 0 APR credit card offers right after the holiday season ends. Knowing that if you’re like 98% of the American public, you’ll leap at the chance to consolidate credit debt and transfer balances to 0 annual percentage rates credit cards. cccccei https://headachemedi.com – Headache drugs over the counter

  38. best headache med February 14, 2021 at 6:40 pm

    Thanks for your thoughts. One thing I’ve got noticed is the fact banks in addition to financial institutions understand the spending behaviors of consumers and as well understand that the majority of people max outside their cards around the breaks. They smartly take advantage of that fact and then start flooding ones inbox in addition to snail-mail box having hundreds of no interest APR credit cards offers shortly after the holiday season closes. Knowing that for anyone who is like 98% in the American general public, you’ll soar at the one opportunity to consolidate consumer credit card debt and switch balances towards 0 interest rate credit cards. nmmlkno https://headachemedi.com – best headache med

  39. best thyroid meds February 15, 2021 at 5:06 am

    Thanks for your suggestions. One thing I’ve noticed is the fact that banks as well as financial institutions really know the spending routines of consumers as well as understand that many people max away their own credit cards around the vacations. They sensibly take advantage of this particular fact and begin flooding your own inbox as well as snail-mail box along with hundreds of Zero APR credit card offers right after the holiday season finishes. Knowing that if you’re like 98% of all American open public, you’ll leap at the opportunity to consolidate credit debt and move balances to 0 annual percentage rates credit cards. eeeedgj https://thyroidmedi.com – best thyroid meds

  40. thyroid pain medicine February 15, 2021 at 6:58 am

    Thanks for your ideas. One thing I have noticed is that banks and financial institutions know the spending habits of consumers and understand that most people max out their credit cards around the holidays. They wisely take advantage of this fact and start flooding your inbox and snail-mail box with hundreds of 0 APR credit card offers soon after the holiday season ends. Knowing that if you are like 98% of the American public, you’ll jump at the chance to consolidate credit card debt and transfer balances to 0 APR credit cards. bbbbbba https://thyroidmedi.com – thyroid pain medicine

  41. stomach threatment February 15, 2021 at 11:40 pm

    Thanks for your concepts. One thing we’ve noticed is banks along with financial institutions are aware of the spending practices of consumers while also understand that most of the people max out there their real credit cards around the getaways. They properly take advantage of this specific fact and commence flooding your current inbox along with snail-mail box using hundreds of no-interest APR card offers just after the holiday season comes to an end. Knowing that should you be like 98% of American community, you’ll rush at the possiblity to consolidate card debt and shift balances for 0 apr interest rates credit cards. jiiihkm https://stomachmedi.com – stomach threatment

  42. notebook camel February 16, 2021 at 3:33 pm

    I want to thank you for the efforts you’ve place in writing this website.
    I am just hoping to view the identical high-grade articles or content of your stuff in the foreseeable future at the same time.

    Actually, your creative writing abilities has encouraged me to get my unique
    website now 😉

    Feel free to surf to my page :: notebook camel

  43. generic stomach medicine February 16, 2021 at 4:36 pm

    Thanks for your concepts. One thing we’ve noticed is banks along with financial institutions are aware of the spending practices of consumers while also understand that most of the people max out there their real credit cards around the getaways. They properly take advantage of this specific fact and commence flooding your current inbox along with snail-mail box using hundreds of no-interest APR card offers just after the holiday season comes to an end. Knowing that should you be like 98% of American community, you’ll rush at the possiblity to consolidate card debt and shift balances for 0 apr interest rates credit cards. ihhhgjl https://pancreasmedi.com – generic stomach medicine

  44. best stomach meds February 16, 2021 at 6:32 pm

    Thanks for your suggestions. One thing I’ve noticed is the fact that banks as well as financial institutions really know the spending routines of consumers as well as understand that many people max away their own credit cards around the vacations. They sensibly take advantage of this particular fact and begin flooding your own inbox as well as snail-mail box along with hundreds of Zero APR credit card offers right after the holiday season finishes. Knowing that if you’re like 98% of all American open public, you’ll leap at the opportunity to consolidate credit debt and move balances to 0 annual percentage rates credit cards. eeeddfj https://pancreasmedi.com – best stomach meds

  45. medicine for kidney February 17, 2021 at 2:18 pm

    As a Newbie, I am continuously exploring online for articles that can be of assistance to me. Thank you

  46. generic kidney medicine February 17, 2021 at 2:46 pm

    As a Newbie, I am continuously exploring online for articles that can be of assistance to me. Thank you

  47. best kidney medications February 17, 2021 at 3:28 pm

    As a Newbie, I am permanently browsing online for articles that can benefit me. Thank you

  48. what to take for kidney pain February 17, 2021 at 4:27 pm

    As a Newbie, I am continuously exploring online for articles that can be of assistance to me. Thank you

  49. drugs used to threat kidney February 17, 2021 at 5:10 pm

    As a Newbie, I am permanently exploring online for articles that can benefit me. Thank you

  50. Donaldvic February 17, 2021 at 8:59 pm

    Very high quality article

    free robux

  51. rufus download windows iso February 17, 2021 at 9:07 pm

    Have you ever considered about including a little bit more than just your articles?
    I mean, what you say is fundamental and everything. Nevertheless just imagine if you added
    some great pictures or video clips to give your posts more,
    “pop”! Your content is excellent but with images and videos, this site could certainly be one of the best in its field.
    Excellent blog!

  52. shell download February 18, 2021 at 4:53 am

    I like the valuable information you provide in your articles.
    I will bookmark your blog and check again here frequently.
    I am quite certain I will learn lots of new stuff right here!
    Best of luck for the next!

  53. zippered wallet March 1, 2021 at 10:49 am

    I have to many thanks for the efforts you’ve devote scripting this site.
    I’m hoping to look at the same high-grade content on your part down the road also.
    In fact, your creative writing abilities has motivated me to
    have my own site now 😉

    my homepage … zippered wallet

  54. Jeffreytoise March 11, 2021 at 12:35 pm

    viagra from canada viagra cost
    viagra from india

  55. Jeffreytoise March 12, 2021 at 11:12 am

    viagra without a doctor prescription usa viagra from india
    viagra cost

  56. water pill furosemide March 15, 2021 at 8:55 pm

    furosemide for dogs 90 furosemide side effects of lasix in dogs a nurse is planning discharge teaching for a client who has a prescription for furosemide

  57. iv furosemide March 17, 2021 at 2:14 am

    loop diuretics furosemide cheap lasix 40 mg does furosemide cause erectile dysfunction why is my lasix not working

  58. Joyce March 19, 2021 at 9:50 am

    Hey there! This post couldn’t be written any better! Reading through this post reminds me of my good old
    room mate! He always kept chatting about this. I will forward this write-up to him.
    Pretty sure he will have a good read. Many thanks for sharing!

  59. ThomasLoK March 20, 2021 at 3:58 pm

    best place to buy generic viagra online https://viagrapills100.com/ where can i buy viagra over the counter

  60. twnruylgym March 27, 2021 at 10:45 pm

    Muchas gracias. ?Como puedo iniciar sesion?

  61. antalya haber March 31, 2021 at 3:07 pm

    Very quickly this website will be famous amid all blogging and site-building visitors, due to it’s fastidious articles

  62. antalya böcek ilaçlama March 31, 2021 at 4:20 pm

    Normally I do not learn article on blogs, but I would like to say that this write-up very forced me to take a look
    at and do it! Your writing style has been amazed me.

    Thank you, quite great article.

  63. takipçi satın al March 31, 2021 at 5:18 pm

    These are really fantastic ideas in concerning blogging.

    You have touched some nice things here. Any way keep up
    wrinting.

  64. takipçi satın al March 31, 2021 at 5:46 pm

    Wow, amazing blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your site is magnificent, let alone the
    content!

  65. antalya kepez haberleri March 31, 2021 at 7:51 pm

    hello there and thank you for your information – I have certainly
    picked up anything new from right here. I did however expertise some technical
    issues using this website, since I experienced
    to reload the web site lots of times previous to I could get it to load
    correctly. I had been wondering if your web hosting is
    OK? Not that I am complaining, but sluggish loading instances times will often affect your
    placement in google and can damage your high quality score if
    ads and marketing with Adwords. Anyway I am adding
    this RSS to my email and can look out for a lot more of your respective exciting content.
    Ensure that you update this again very soon.

  66. ScottRorne April 1, 2021 at 11:58 pm

    cefixime capsules: buy augmentin
    buy biaxin online

  67. takip2018 April 2, 2021 at 3:34 pm

    I couldn’t resist commenting. Exceptionally well written!

  68. get more info April 7, 2021 at 2:16 am

    The English are a nation of ship keepers.

  69. Billybib April 8, 2021 at 7:53 pm

    ed pills for sale: ed meds over the counter ed medication

  70. Billybib April 9, 2021 at 10:47 pm

    male erectile pills: cialis pills erectile dysfunction pills

Leave a comment

Your email address will not be published. Required fields are marked *