Blog

Archive for the ‘performance’ Category

css

Using the General Sibling Selector (CSS)

Sunday, August 22nd, 2010

The general sibling selector can be very useful in reducing css code in your style sheets and in your html.

Example:

You have a thumbnail image to the left of a few paragraphs and you don’t want them to wrap below the image.

Instead of using a wrapper div for your paragraphs, you can simple use one declaration:

img ~ p {padding-left:122px;}

This means that all general siblings of an img element will have a left padding value of 122px.

What about older Browsers?

See: http://reference.sitepoint.com/css/generalsiblingselector

In my case, I was not planning on having more than 298 elements, seems excessive. In that case you would want to use a wrapper div for those paragraphs.  As for IE6, I say let the text wrap!

5 ways to optimize the performance and speed of your website

Thursday, August 20th, 2009

1. Improve your performance with YSlow

http://developer.yahoo.com/yslow/

Yslow grades the performance of your site based on 3 rulesets. The criteria includes http requests, gzip compression, javascript placement at bottom, css expressions, dns lookups, minifying css and javascript, url redirects, 404 errors and more.
With Yslow you can figure out what is holding up the page from loading up fast. I typically check under components to see if there are any 404s for files called.

2. Compress Images with Smushit

http://developer.yahoo.com/yslow/smushit/

Compress images even further than saving for web in photoshop with Smushit.

3. Place Javascript at the bottom of your html document

Javascript calls at the bottom allow the page to load without having to wait until the javascript is loaded.

4. Compress CSS and JS Files

http://www.cssoptimiser.com/

http://www.cleancss.com/

http://javascriptcompressor.com/

5. Use CSS Sprites

The concept of css sprites is to combine multiple images into one and using background-position in your css to display only certain images.

See How to use CSS Sprites: http://css-tricks.com/css-sprites/

Video: Exactly How to use CSS Sprites: http://net.tutsplus.com/videos/screencasts/exactly-how-to-use-css-sprites/

Dave Shea explains CSS Sprites: http://www.mezzoblue.com/archives/2009/01/27/sprite_optim/