• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How to Load CSS Without Blocking Rendering (WordPress & Others)

By Abhishek Ghosh October 14, 2016 7:51 am Updated on November 4, 2016

How to Load CSS Without Blocking Rendering (WordPress & Others)

Advertisement

Previously, we talked about how to deliver Javascript in blocking way and Defer Parsing of Javascript in WordPress. CSS part on that guide was probably not optimal. Here is How to Load CSS Without Blocking Rendering in WordPress & Others. Render Blocking CSS is Common Error on Google PageSpeed Insights. In this guide, we will remove the rest of the blocking CSS.

 

How to Load CSS Without Blocking Rendering WordPress : Where To Start From?

 

Problems are more in WordPress as control of delivery CSS, Js is lesser. For the sake of GooglePage Speed, this is very good plugin :

Vim
1
https://wordpress.org/plugins/async-js-and-css/

There are more such plugins for WordPress. On that plugin, we use this setting :

Advertisement

---

Load Javascript asynchronously [ticked]
Detect tags in wp_head [not ticked]
Load CSS asynchronously [ticked]
CSS loading method [(default)Inserting all CSS styles inline into the document HEADER]
Minify CSS [ticked]
Remove “?ver=XXX” part from URLs [ticked]
Exceptions (files to ignore and load in render-blocking way) [none]

That settings inline some CSS leaving Font CSS, Icon Font CSS and other few CSS to inline. They show as Load CSS Without Blocking Rendering message on Google PageSpeed Insights. This may be your case or slightly different. We already made critical CSS inline.

 

How to Load CSS Without Blocking Rendering WordPress & All Others

 

Normally we load CSS in this way :

Vim
1
<link rel="stylesheet" href="https://cdn.thecustomizewindows.com/css1.css" media="all">

But if we load the same in this way :

Vim
1
<link rel="stylesheet" href="https://cdn.thecustomizewindows.com/css1.css" media="none" onload="if(media!='all')media='all'">

The CSS not going to block the rendering. But the technique uses JavaScript. For the browsers with no-JavaScript enabled, we need to offer a second way (which is blocking way) :

Vim
1
2
<link rel="stylesheet" href="https://cdn.thecustomizewindows.com/css1.css" media="none" onload="if(media!='all')media='all'">
<noscript><link rel="stylesheet" href="https://cdn.thecustomizewindows.com/css1.css"></noscript>

But if you add both set to header, again on Google PageSpeed Insights on mobile you’ll get info that CSS is blocking rendering. So final fix is, put this part on header :

Vim
1
<link rel="stylesheet" href="https://cdn.thecustomizewindows.com/css1.css" media="none" onload="if(media!='all')media='all'">

and the noscript part on footer :

Vim
1
<noscript><link rel="stylesheet" href="https://cdn.thecustomizewindows.com/css1.css"></noscript>

I have not seen problem on MacOS Safari, Chrome, Firefox with this method for non-critical CSS. MacOS Opera probably can not load properly. We hope, you’ll get some score like this :

how-to-load-css-without-blocking-rendering-wordpress-others

For making failsafe, I have to send you here :

Vim
1
https://github.com/filamentgroup/loadCSS

Quick info on Defer Parsing of Javascript and Eliminate Render Blocking Script in WordPress:

This is non-blocking way for individual CSS :

Vim
1
<link rel="stylesheet" href="https://cdn.domain.com/my.css" media="none" onload="if(media!='all')media='all'"><noscript><link rel="stylesheet" href="https://cdn.domain.com/my.css"></noscript>

Why, that is explained above.

This is non-blocking way for individual Js :

Vim
1
<script type='text/javascript' src='https://cdn.domain.com/my.js' async defer>execOnReady(function(){execOnReady(function(){});});</script>

Why, that is explained elsewhere on this website.

Tagged With Eliminate render-blocking resources css/stylesheet without plugins , https://thecustomizewindows com/2016/10/load-css-without-blocking-rendering-wordpress-others/ , wordpress css loading slow

This Article Has Been Shared 844 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Load CSS Without Blocking Rendering (WordPress & Others)

  • Configuring WP Super Cache With Origin Pull or Origin Push CDN

    Configuring WP Super Cache with a CDN is a bit tricky but if properly done if works great. In this tutorial, we will show to configure WP Super Cache with both Origin Pull and Origin Push CDN.

  • List of Open Source PHP MySQL Based Blogging Softwares

    List of Open Source PHP MySQL Based Blogging Softwares lists the most commonly used and available softwares those can run on any LAMP server easily.

  • Bootstrap Genesis Child Theme : Do it Yourself Guide

    Bootstrap Genesis Child Theme can easily be created by modifying the default CSS of existing Eleven40 Child Theme plus some custom templates. Here is how.

  • WordPress Post to Downloadable PDF, Text : Practical Options

    WordPress Post to downloadable PDF, Text has many points to consider when we will think about the usability, SEO, HTML5 and Schema.org markups.

  • Icon-Font : Using with WordPress

    Icon-Font is Icons but is in Font format – that simply means, what you used commonly as image and increased your page loading time can be reduced and made cool.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (21K Followers)
  • Twitter (5.3k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • How to Build a DIY Water Level Indicator? April 16, 2021
  • How Startups Can Convince the Investors April 14, 2021
  • What to Know About the Cloud Storage Services for Smartphones April 13, 2021
  • WonderFox HD Video Converter Factory Pro Review April 10, 2021
  • What is the Maximum Cable Length Between Arduino/ESP32 and a Sensor April 8, 2021

 

About This Article

Cite this article as: Abhishek Ghosh, "How to Load CSS Without Blocking Rendering (WordPress & Others)," in The Customize Windows, October 14, 2016, April 17, 2021, https://thecustomizewindows.com/2016/10/load-css-without-blocking-rendering-wordpress-others/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2021 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy