|Does text-to-code ratio matter? CSS external vs inline?|
| 1:45 am on Aug 31, 2011 (gmt 0)|
I could improve load time by about 100 ms by moving my external CSS inline. But would it be bad for SEO?
My CSS would add approximately 6,000 characters to each of my pages.
Is text-to-code ratio really a part of SE algo, or is it just a rumor?
Does the text-to-code ratio rally change if CSS is inline vs external?
Has anyone does some tests? Has any Google employee ever said something on this topic?
Thanks for any info you may share.
| 2:49 am on Aug 31, 2011 (gmt 0)|
Wait. Do you mean inline (<td style = "text-align: left">, that kind of thing), or do you just mean page-specific?
| 3:53 pm on Aug 31, 2011 (gmt 0)|
Wouldn't that only improve load time for the first pageview, and then reduce it for subsequent pageviews? Is that worth it? What's your average pageviews per visit?
| 4:03 pm on Aug 31, 2011 (gmt 0)|
CSS should go in external file so that it is loaded once per user session not once per page view.
| 1:33 pm on Sep 9, 2011 (gmt 0)|
Sorry for my delay in replying.
I ended up implementing it. Now my CSS is a part of the base html file.
This is just my hobby site, so I don't mind taking risks and experimenting. It is a vBulletin-based forum, but it has been modified quite a bit for speed. For not-logged-in users, the home page now only has 3 http requests, individual forum sections have now only 2 http requests, and threads also only 2 http requests (excluding user-posted images, if any, and Adsense, if any).
Having so few http requests, I thought one request saved was a big deal percentage-wise, so I ended up doing it.
| 2:37 pm on Sep 9, 2011 (gmt 0)|
If the CSS part increases the page size over 4K (gzipped), it would be fragmented and would take 2 TCP packets. Although it is still 1 HTTP request, the page load time would be (page generation + latency*2)
| 2:56 pm on Sep 9, 2011 (gmt 0)|
Thanks, Levo. Gzipped, the size before was about 5.5K, now it is just over 7K, if memory serves. That's for home page. I can look at numbers for inner pages a bit later.