Reputation: 55
I'm trying to load a woff2 font file within a CSS file. But I keep getting an error saying that the file can't be found. But the path is correct.
My CSS file:
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url("C:\Users\win10\Desktop\Electron_Projects\EnderFramework\_themes\_default\fonts\material_icons.woff2") format('woff2');
}
icon, icons{
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
font-feature-settings: 'liga';
}
And this is the error that I keep getting:
Failed to load resource: net::ERR_FILE_NOT_FOUND file:///C:/Userswin10%C3%9Esktop%0Electron_Projects%0EnderFramework_themes_default%0Fontsmaterial_icons.woff2:1
Upvotes: 1
Views: 2426
Reputation: 607
Try to specify an incomplete file path, relative.
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url("..\fonts\material_icons.woff2") format('woff2');
}
Also, an error may be caused due to the use of backslash.
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url("../fonts/material_icons.woff2") format('woff2');
}
Upvotes: 1