WebPagetest Forums
With request for html page - send html AND css file - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Optimization Discussions (/forumdisplay.php?fid=5)
+--- Thread: With request for html page - send html AND css file (/showthread.php?tid=464)



With request for html page - send html AND css file - JesseG - 12-17-2010 03:52 AM

Rather than wait for the browser to grab the first 10 lines of the html, and then start downloading the css file - it would be faster for me to send the css file the instant the html file is requested.

Seems like there would be an apache directive for this sort of thing.

Any ideas how to do it?


RE: With request for html page - send html AND css file - pmeenan - 12-17-2010 05:06 AM

Sure, it's called inline css :-)

Seriously, there's no push support in http. SPDY provides some support for hinting to the browser but the first 10 lines of HTML arrive in the first packet (certainly the first round trip) so you're not going to be able to get much faster than that.


RE: With request for html page - send html AND css file - JesseG - 12-18-2010 04:58 AM

Ok, inline css it is.

Shaved off 0.2 seconds. Thanks.


RE: With request for html page - send html AND css file - jesper_mortensen - 12-25-2010 10:46 PM

Just a quick comment, fairly obvious but worth keeping in mind: Whether in-lining CSS is a net win or not will depend on the user behavior. If the user looks at just 1-2 webpages, then inlining is faster because you save one HTTP request. If the user look as several pages, then external CSS is faster overall, because the external CSS is a separate document which will be cached by the browser (since you're of course serving your CSS with long cache headers).


RE: With request for html page - send html AND css file - Geebee - 01-03-2011 06:35 PM

I guess this is the reason that Google does inline CSS? To miss that extra request?


RE: With request for html page - send html AND css file - jesper_mortensen - 01-04-2011 12:49 AM

(01-03-2011 06:35 PM)Geebee Wrote:  I guess this is the reason that Google does inline CSS? To miss that extra request?

Yes, it is. Smile