January 20, 201412 yr 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
January 20, 201412 yr 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 January 20, 201412 yr by PipeTenHostingCarl
January 20, 201412 yr 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.
January 20, 201412 yr 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'; }
January 24, 201412 yr 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