Ich habe versucht, eine benutzerdefinierte Schriftart für meine Website einzurichten, aber es funktioniert nicht in Firefox, Chrome oder Edge/IE. Der Netzwerkabschnitt in den Entwicklerwerkzeugen von Firefox besagt, dass die Schriftarten nicht gefunden wurden und listet 404s auf, obwohl die URLs korrekt sein sollten. Dies ist mein Code:@ font-face gibt 404s auf Schriftarten zurück
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/RalewayRegular.ttf') format('truetype'),
url('/wp-content/uploads/font-organizer/ralewayregular-webfont.woff') format('woff'),
url('/wp-content/uploads/font-organizer/ralewayregular-webfont.woff2') format('woff2');
font-weight: normal;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-Light.ttf') format('truetype');
font-weight: 300;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-LightItalic.ttf') format('truetype');
font-weight: 300;
font-style: italic;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-Italic.ttf') format('truetype');
font-style: italic;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-SemiBold.ttf') format('truetype');
font-weight: 600;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-SemiBoldItalic.ttf') format('truetype');
font-weight: 600;
font-style: italic;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-Bold.ttf') format('truetype');
font-weight: 700;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-BoldItalic.ttf') format('truetype');
font-weight: 700;
font-style: italic;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-ExtraBold.ttf') format('truetype');
font-weight: 800;
}
@font-face {
font-family: 'Raleway55';
src: url('/wp-content/uploads/font-organizer/Raleway-ExtraBoldItalic.ttf') format('truetype');
font-weight: 800;
font-style: italic;
}
body { font-family: 'Raleway55'!important; font-weight:normal!important; }
h1 { font-family: 'Raleway55'!important; font-weight:normal!important; }
h2 { font-family: 'Raleway55'!important; font-weight:normal!important; }
h3 { font-family: 'Raleway55'!important; font-weight:normal!important; }
h4 { font-family: 'Raleway55'!important; font-weight:normal!important; }
h5 { font-family: 'Raleway55'!important; font-weight:normal!important; }
h6 { font-family: 'Raleway55'!important; font-weight:normal!important; }
p { font-family: 'Raleway55'!important; font-weight:normal!important; }
q { font-family: 'Raleway55'!important; font-weight:normal!important; }
li { font-family: 'Raleway55'!important; font-weight:normal!important; }
a { font-family: 'Raleway55'!important; font-weight:normal!important; } <code>
Können Sie helfen? Vielen Dank!
Versuchen Sie, '/' aus '/ wp-content /' zu entfernen. –
Anstatt alle Elemente font-family zu deklarieren, verwenden Sie einfach '* {font-family: 'Raleway55';}'. Setzen Sie es nicht auf wichtig oder es wird später schwieriger, es zu ändern. –
Eine letzte Sache, wenn das Stylesheet in einem Ordner ist, können Sie '../' vor einer URL verwenden, um den übergeordneten Ordner darzustellen. Sagen wir 'wp-content/stylesheets' und Ihre Fonts sind' wp-content/fonts ', dann würden Sie' ../ fonts/myfont.fontExtension' eingeben. –