Skip Navigation

[Resolved] Stylesheet loads after HTML is displayed causing delay in UI

This support ticket is created 2 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by simchaH 2 years, 9 months ago.

Author
Posts
#2329249

Hi,

I am wondering if there is a solution for this - my HTML loads before my CSS/Stylesheet. Because of this, my web pages look really ugly for a couple of seconds, until the CSS kicks in. Is there any way to change that and make the CSS load first, or at least to delay loading the page an extra second so that they can both load at the same time?

Thank You,
Sim

#2329279

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I assume you are referring to the content of pages designed with Toolset Blocks, specifically the content rather than the header and footer.

This styling gets applied via JavaScript, which does mean there can be a perceptible delay.

I would suggest identifying a container div for the content section (it will depend on your theme, but may be a div with id="main" or similar), and then add a style rule to some stylesheet which is enqueued normally in the head (e.g. a theme stylesheet, or enqueue a new one) that sets the opacity of the container div to zero, and then add a small JS snippet to a script enqueued in the footer which sets the opacity to 1.

If you need help with that let us know.

#2329803

Thanks Nigel, it helped a lot. My issue is resolved now. Thank you!