Upon initially visiting the site, the @font-face fails to load and requires a manual refresh or reload to appear correctly

After configuring the CSS file using the fontface generator from fontsquirrel.com and uploading the font files to the correct directory, the fonts on my website function properly. However, there is an issue where the fonts do not display the first time a user enters the website until the page is refreshed, occurring in both Firefox and Chrome.

The CSS code at the top of my file looks like this:

@charset "utf-8";
body { margin:0; padding:0; width:100%; background:url(images/bg.png) repeat; }
html { padding:0; margin:0; }
a { text-decoration:none; border: none; outline:none; }
a:hover { text-decoration:underline; }
a img {border: none; }

@font-face{ font-family: 'handfont-webfont'; src: url('text/handfont-webfont.eot'); src: url('text/handfont-webfont.eot?#iefix') format('embedded-opentype'), url('text/handfont-webfont.woff') format('woff'), url('text/handfont-webfont.ttf') format('truetype'), url('text/handfont-webfont.svg#webfont') format('svg'); }

Below is the code for applying the font to paragraphs on my pages:

.body p { font-family:handfont-webfont; font-size: 12px; padding:5px 5px; margin:0; }

I have searched for a solution to this problem but have been unsuccessful so far. Any assistance would be greatly appreciated. Thanks, everyone!

Answer №1

Did you attempt to place the @font-face declaration at the top of your CSS file, before anything else?

There seems to be a mistake in your CSS code:

.body p { font-family:handfont-webfont;}//missing single quotes

Please update it to this:

.body p { font-family:'handfont-webwebfont';}//make sure to use single quotes

Answer №2

Experiment with-

 font-family:'handfont-webfont' 

and see if it works better as

font:'handfont-webfont'

within the .body p tag

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tables that adapt to different screen sizes, displaying perfectly on desktop but with slight variations on mobile devices

I recently experimented with a demo to enhance the performance of tables on my website in development. The demo worked flawlessly on my desktop when I resized using a responsive tester extension for Chrome: https://i.stack.imgur.com/KzFiR.jpg However, u ...

Failure to capture spaces in onChange events for <input> elements

I'm having an issue where the onChange event is not being called on my HTML input element when pressing the space bar. Here's a snippet of what I've tried: class FilterDropDown extends React.PureComponent { state = { query: '&ap ...

Achieving Distinct Values in an Observable Array Property - Angular

I have created an Angular application that utilizes a service to retrieve data from a mock API. The data returned is in the form of an array containing objects, as shown below: [ { "userId": 1, "id": 1, "title": "quidem molestiae enim" }, ...

Different Ways Split Button Format Can Vary Based on Web Browser

I am encountering a formatting issue with a jQuery splitbutton on my webpage. In order to adhere to my company's design standards, I am essentially converting a link into a button. The functionality works perfectly fine; however, depending on the brow ...

Having trouble getting custom tabs in jQuery to function properly?

I am facing an issue with a simple script I have created. The script is supposed to display a specific div when a user clicks on a link, and hide all other divs in the container. However, when I click on the link, nothing gets hidden as expected. Even afte ...

Tips for customizing the appearance of a label when a MUI Radio Button is selected

Hello everyone, I am attempting to customize the label text color of a radio button to turn blue when selected. https://i.stack.imgur.com/btSc2.jpg HERE IS THE CODE FOR MY MUI BUTTON SO FAR import * as React from "react"; import Radio from &quo ...

The webpage loaded through ajax is not rendering correctly

One of the challenges I'm facing is getting a JavaScript script to load an HTML page into a specific div element on another HTML page: The page that's being loaded, startScreen.html, looks like this: <!DOCTYPE html> <html lang="en ...

What is the best way to capture a form submission when there are no errors?

My form includes a validation check for valid fields upon submission. Here is an example of how it is structured: <form class="form-horizontal" method="post" action="#" name="basic_validate" id="basic_validate" /> <div class="con ...

Is there a way to display the division symbol using PHP?

I have come across this question multiple times, but am yet to find a satisfactory resolution. Is there a way to output the division sign (÷) using PHP? Every time I attempt to echo it, the output is just showing a strange symbol . ...

Error accessing property 'offsetwidth' of null in Google Maps JavaScript API

I am currently utilizing the Google Maps JS API to showcase a map on my website. However, I am encountering an issue where the website is displaying an empty card and upon inspecting the elements, I came across the error message: Cannot read property &apos ...

Trouble with CSS styling arising when launching the MVC application on IIS

Currently working on a website in ASP.Net MVC 5. I am trying to test it on my local IIS (version 8), but encountering an issue where the CSS styling is not being applied. In my _layout.cshtml file, I opted for direct link tags instead of using bundles. &l ...

Divs expanding below content in IE on a particular server

Currently, I am facing an issue with a JavaScript div that expands correctly over other content in most situations but goes under the content in one specific scenario. I am unsure about where to begin debugging this problem. To provide some context, the d ...

Ensure that buttons appear neat and organized when viewed on mobile devices

As a CSS beginner utilizing the Bootstrap framework, I have encountered an issue with my button layout on mobile devices. I have successfully created a set of buttons that display correctly on both desktop and mobile views. In the desktop view, you can se ...

Putting off the execution of a setTimeout()

I'm encountering difficulties with a piece of asynchronous JavaScript code designed to fetch values from a database using ajax. The objective is to reload a page once a list has been populated. To achieve this, I attempted to embed the following code ...

Basic CSS text overlay on top of images

Hey there! I'm in need of some assistance with displaying text over an image. Specifically, I'd like the text to appear on the left side of the two people in the image and remain proportional when transitioning from desktop to tablet view using m ...

Incorporate additional form element functionalities using radio inputs

Recently, I created code that allows a user to duplicate form elements and add values by clicking on "add more". Everything is functioning properly except for the radio inputs. I am currently stuck on this issue. Does anyone have any suggestions on how I c ...

Utilizing rvest to extract user videos from Twitter

When using rvest to extract data from websites, I found that I am unable to scrape dynamic content. For instance, how can I extract the audience count (44K) from this video post? https://i.sstatic.net/CRXZ9.png Here's what I attempted: library(rves ...

When the border width is set to 1px in FireFox, the border size is calculated as 0.667

When using the FireFox browser alone, I noticed that the border size is displayed as 0.6667 when setting the border width to 1px on a div, input element, or any HTML element. The same issue occurs whether the border is applied using inline CSS or a separat ...

Organizing table data by columns in a continuous loop

I'm currently working on extracting data from a database, organizing it into tables (potentially multiple tables), and presenting them in columns of 4 across several pages. My main concern is figuring out how to display the tables horizontally like t ...

How can I prevent the content from sliding out of view in a Bootstrap carousel?

I am looking to create a slider that includes a form or text. However, I have noticed that when scaling up by 50-75% or when there is a lot of content, the content extends beyond the slider. Image Check out my code on jsfiddle: jsfiddle.net/sL70r2an/ ...