Showing posts with label css. Show all posts
Showing posts with label css. Show all posts

July 8, 2010

Putting a head tag below a body tag

It is possible to put <head> tags underneath <body> tags. Why do this? One reason is to make cache instructions work better, as described by Microsoft here.

Another is described in High Performance Web Sites: Rule 6 – Move Scripts to the Bottom by Steve Souders, Yahoo!'s Chief Performance Yahoo!

With stylesheets, progressive rendering is blocked until all stylesheets have been downloaded. That’s why it’s best to move stylesheets to the document HEAD, so they get downloaded first and rendering isn’t blocked. With scripts, progressive rendering is blocked for all content below the script. Moving scripts as low in the page as possible means there's more content above the script that is rendered sooner.

The second problem caused by scripts is blocking parallel downloads.

March 16, 2010

CSS positioning

http://stackoverflow.com/questions/2451043/change-an-absolutely-positioned-webpage-into-a-centered-one/2451067#2451067

FINISH POST

December 16, 2009

CSS text alignment quirk

NOT OKAY:
<span style="text-align: center">
WORKS FINE:
<div style="text-align: center">

This is because span is an inline element but div is a block-level element. The text will technically be centered inside the span, but that's meaningless because the span will wrap itself tightly around its contents and will itself be placed where page flow dictates. Generally, a div will have the same width as its container, resulting in the desired effect.