• 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
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, 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)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Eliminate Render-blocking Javascript and CSS WordPress

    Eliminate Render-blocking Javascript and CSS WordPress – Possibly all the users of WordPress face this dangerous looking warning in Google PageSpeed Insights.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • How To Install mod_pagespeed on Rackspace Cloud Server

    Step by Step Guide on How To Install mod_pagespeed on Rackspace Cloud Server Running Ubuntu 13.10 plus Add On Tips to Configure Cloud Files.

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

Get new posts by email:

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 (24.3K Followers)
  • Twitter (5.8k 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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

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

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