I have a custom font I would like to use on a webpage. Specifically GT-Walsheim-Pro-Medium-Oblique.woff from:
https://andrewsonline.co.uk/content/fonts/
The style.css I am working with is this:
https://github.com/syunghong/veil/blob/master/css/style.css
How do I incorperate this font file using #fontface into my style.css file?
I have GT-Walsheim-Pro-Medium-Oblique.woff in a folder called fonts.
here
#font-face {
font-family: 'RobotoBold'; /*this is what you put on your font family*/
src: url('../fonts/Roboto-Bold.ttf'); /*Link to the font*/
}
to use it
p {
font-family: RobotoBold;
font-size: 14;
}
If you own the rights to use the webfont, take the original ttf or otf font and render a full set here at FontSquirrel. Different browsers prefer different font types, the older browsers are pickiest.
Then add the font to the top of your stylesheet so it's loaded first or even before the stylesheet inline if you see FOUT, "Flash of Unstyled Text". More info here but basically you want the font loaded and ready before your html starts loading.
Then load your font like this:
#font-face {
font-family: 'GT Walsheim Pro Medium Oblique';
src: url('GT-Walsheim-Pro-Medium-Oblique.eot');
src: url('GT-Walsheim-Pro-Medium-Oblique.eot?#iefix&v=4.6.3') format('embedded-opentype'),
url('GT-Walsheim-Pro-Medium-Oblique.woff2') format('woff2'),
url('GT-Walsheim-Pro-Medium-Oblique.woff') format('woff'),
url('GT-Walsheim-Pro-Medium-Oblique.ttf') format('truetype'),
url('GT-Walsheim-Pro-Medium-Oblique.svg') format('svg');
font-weight: normal;
font-style: normal;
}
Font Squirrel will output the above code for you when you render the font package there.
Call the font in your css like this, I'm using your H titles as an example, make sure to always have a fallback for the font in case it errors or doesn't load for some reason:
h1, h2, h3, h4, h5, h6 {
font-family: 'GT Walsheim Pro Medium Oblique', arial, sans-serif;
}
Related
I am currently trying to import a font with the #font-face CSS element, but it is not working/ showing up. It is the font Francaise from Dafont.com, it is in the css folder with the stylesheet, but will not change my header font to desired font.
I have already tried searching Stack for similar queries, but each attempt is in vain.
#font-face {
font-family: 'Francaise';
src: local('Francaise Regular Demo.ttf') format('truetype');
}
I have anticipated my header text to be the aforementioned font, but it only shows up as the fallback font, cursive Comic Sans.
You have to use #font-face url without adding white space. Just rename your font and try the following structure.
#font-face {
font-family: 'Francaise';
font-style: normal;
font-weight: 400;
src: url('francaise-regular-demo.ttf'); /* IE9 Compat Modes */
src: local('Francaise Regular Demo'), local('Francaise Regular Demo'),
url('francaise-regular-demo.ttf') format('truetype');
}
Use the font-family: 'Francaise'; in your css.
first check the
Browser Support for Font Formats
use src for font
#font-face {
font-family: myFirstFont;
src: url(sansation_light.woff);
}
* {
font-family: myFirstFont;
}
you can refer the site
http://fontsforweb.com/index.php
I am building a website for school, and want to use a special font, but when I import it, it doesn't show the font. I tried using the #face-font{font-family: something; src: url(font.ttf); The css I use it on looks like this: header{font-family: something;}And I tried this also with a .otf file, but that didn't work either. I also tried <link ref="font" href="font.ttf"> And also this with a .otf file. But in al cases the font didnt show up. Is it my fault in some code, or is the font just not useable? The link to the font is: http://www.fontspace.com/darrell-flood/quiet-meows
To include the custom font you'll need this somewhere in your CSS:
#font-face {
font-family: 'QuietMeows';
src: url('../fonts/quiet_meows.ttf') format('truetype'),
url('../fonts/quiet_meows.otf') format('opentype');
}
After downloading the font you will need to move it into your project, I put it into a fonts folder and renamed to be quiet_meows.
Then you can use it in your CSS like this:
p {
font-family: 'QuietMeows';
}
Note: If the name of a font family is more than one word, it must be in quotation marks, like: "Times New Roman".
<style>
#font-face {
font-family: myFirstFont;
src: url(sansation_light.woff);
}
#font-face {
font-family: myFirstFont;
src: url(sansation_bold.woff);
font-weight: bold;
}
* {
font-family: myFirstFont;
}
</style>
</head>
<body>
<h1>The #font-face Rule</h1>
<div>
With CSS, websites can use <b>fonts other than the pre-selected "web-safe" fonts</b>.
</div>
<p><b>Note:</b> Internet Explorer 8 and earlier, do not support the #font-face rule.</p>
The problem was fixed by adding the format tag. After this, the font did show up on the page. The end looked like this.
#font-face{
font-family: "quiet meows";
src: url('font.ttf') format('truetype');
}
I'm at my wits end with this problem. I'm trying to include a font. The CSS file is located at project/css/.
My font is located at project/fonts/iconfont/.
I have the following font files in that folder (even though I'd probably only need woff):
icons.eot
icons.svg
icons.ttf
icons.woff
This is how I try to include my font:
#font-face {
font-family: icons;
src: url(../fonts/iconfont/icons.woff) format('woff');
font-weight: normal;
font-style: normal;
}
However I can't use the font. Checking with Chrome developer tools it doesn't even load. What am I doing wrong here?
Try to link all fonts format in #font-face selector and call font-family with custom name in quotation marks.
/*--- Define a custom web font ---*/
#font-face {
font-family: 'YourWebFont';
src:
url('../fonts/iconfont/icons.woff') format('woff'),
url('../fonts/iconfont/icons.ttf') format('ttf'),
url('../fonts/iconfont/icons.eof') format('eof'),
url('../fonts/iconfont/icons.svg') format('svg');
}
/*--- Use that font on the page ---*/
body {
font-family: 'YourWebFont', sans-serif;
}
Good luck!
I'm trying to import a CSS font but unfortunately it's not working and I'm really unsure why.
The font in the filesystem called 'deadjim.ttf' It is placed inside my main public_html and yes it is the correct path, visiting the path downloads the file.
#font-face {
font-family: 'deadjim';
src: url('http://url.com/deadjim.ttf'); /*URL to font*/
}
I've tried clearing my cache but this hasn't worked either. Apparently it's working on Safari but I have no means of checking having a windows PC
Make sure that you're calling the font like normal; #font-face doesn't apply any styles to the html, it just defines the font.
#Define your font
#font-face {
font-family: 'deadjim';
src: url('http://url.com/deadjim.ttf'); /*URL to font*/
}
#Will apply the font as default on the entire page
html, body{
font-family: 'deadjim';
}
To be sure your font works in all browser / most platforms, you will need to do something similar to this (with all formats provided) - it's not enough to just have the .ttf-file.
Here's an example of including FontAwesome:
#font-face {
font-family: 'fontawesome';
src: url('fontawesome-webfont.eot?v=4.7.0');
src: url('fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),
url('fontawesome-webfont.woff2?v=4.7.0') format('woff2'),
url('fontawesome-webfont.woff?v=4.7.0') format('woff'),
url('fontawesome-webfont.ttf?v=4.7.0') format('truetype'),
url('fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
I installed a web font from myfonts.com on my WordPress site. I updated the CSS as follows:
#import url("../bridge/style.css");
/* LICENSE HERE */
#import url("//hello.myfonts.net/count/xxxxxxx");
#font-face {
font-family: "VeneerTwo";
src: url('http://www.example.com/wordpress/webfonts/xxxxxx_0_0.eot');
src: url('http://www.example.com/wordpress/webfonts/xxxxxx_0_0.eot?#iefix') format('embedded-opentype');
src: url('http://www.example.com/wordpress/webfonts/xxxxxx_0_0.woff2') format('woff2');
src: url('http://www.example.com/wordpress/webfonts/xxxxxx_0_0.woff') format('woff');
src: url('http://www.example.com/wordpress/webfonts/xxxxxx_0_0.ttf') format('truetype');
src: url('http://www.example.com/wordpress/webfonts/xxxxxx_0_0.svg#wf') format('svg');
}
h1, h2, h3, h4, h5 { font-family: "VeneerTwo" !important; }
All the fonts exist on the webserver.
When I check the site in Developer Tools I see that the H2 element has the style VeneerTwo:
h1, h2, h3, h4, h5 {
font-family: "VeneerTwo" !important;
}
Unfortunately, the font of the h2 element is just the default (Times New Roman if I am not mistaken).
Does anyone know why the VeneerTwo font is not displayed and how it can be fixed?
Try putting the #font-face first, before you import other media or css.
But you told that the font is displayed on the developers tool , just try to clear the cache and try again .. Like by pressing ctrl+f5 twice
I want to add the following:
Motivated by the suggestion of #arkascha to check the access logs I just checked it with an old iphone I had layin around (iPhone 4). And yes, on the iPhone 4 the font is being displayed.