Scaling CSS for Large Web Sites

This is a PowerPoint presentation for a talk I gave to Fandor as an outside CSS expert at the invitation of their senior product manager. It summarizes recommendations for methodologies and tools useful in writing, organizing and maintaining CSS code. (Fandor afterwards ended up implementing several of my recommendations.)

Scaling CSS for Large Web Sites

Facebook Tab Design Best Practices

Text/Fonts

Use Browser rendered text whenever possible rather than image-based text.

Advantages to browser-rendered text:

  • Text is easier to edit and update.
  • Increases usability: users can increase text size if needed, etc. to make it easier for them to read.
  • Can improve search engine accessibility.

Browser-safe fonts:

See this site for a comprehensive list of fonts common to both Windows and Mac users:
http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html

Facebook’s default fonts:

Lucida Grande, Tahoma, Verdana, Arial, sans-serif
Default font size: 13 pixels

Note: “Lucida Grande” is installed on most Macs but few Windows users have it so they will likely see Tahoma instead.

Font sizes:

For best readability, main body copy should generally be at least 12 pixels or larger. 10 pixels can be acceptable for less important text like copyright info but it’s preferable to keep all text sizes at 10px+.

Tab/App Content Dimensions

Facebook re-designed Fan Page tabs some time ago to be 520 pixels wide (reduced from previous 760 pixels wide). The 520 pixel width includes all content appearing within a tab so for example if your design includes content inside a box with a drop shadow, the drop shadow needs to fit within the 520 pixel page width.

Place important content “above the fold”

Avoid making users have to scroll too much to see content you want to highlight. Measuring from the top of the Tab canvas area, your most important content should ideally fit within about the first 430 pixels in height.

Don’t re-create your Web site

In general, it’s best to keep Tab designs relatively short and simple with clear calls to action. Avoid creating mini web sites with multiple sub-pages within one tab or extra long designs that require users to scroll too much to view all content. Facebook users can have short attention spans so focus designs on the information or functionality you most want them to see and use.

Web Image Formats and Optimization

Summary of Web Image Types and Appropriate Uses:
(adapted in part from http://yuiblog.com/blog/2008/11/04/imageopt-2/)

  • JPG is the format for photos and full color images with lots of gradients. (JPG file sizes are smaller than PNG24)
  • GIF is the format for animations.
  • PNG8 is the format for everything else — icons, buttons, backgrounds, etc. (size usually smaller than GIF, supports alpha transparency, Fireworks can output variable transparency)
  • PNG24 is the format for full color images with transparency (largest file sizes, requires filter hack for IE6)

PNG8 = 256 indexed color PNGs. Newer versions of Photoshop (CS3) can output these using “Save for web”. Supports alpha transparency just like GIFs but generally results in smaller file sizes than GIFs. Fireworks can output PNG8 with variable transparency which degrades nicely to 100% transparency in IE6.

One slight problem with PNGs is they use gamma correction which can cause problems when colors in a PNG image need to match background colors (so colors will be slightly off in the PNG). This can be solved by using a program like pngcrush to strip the gamma chunk from the image (which reduces file size a bit more as well).

NOTE: When saving images from Photoshop always use “save for web”; results in greatly reduced file sizes than just saving normally.

EXTRA NOTE: Saving JPGs as “progressive” reduces file sizes further in 94% of cases for files over 10k (for under 10k baseline JPGs are generally smaller)

Photoshop CS Layer Styles: Soft Interface Collection

I uploaded 3 Photoshop layer styles designed to be used together to create soft-edged interfaces. Download them from the “Goodies” section of my home page here:

http://kristinbradley.com/goodies/effects.html

Soft Interface Example Soft Interface Button Example Soft Interface Indent Example

Use the “Soft Interface” style to create an interface shape. This style works with a variety of colors or shades of grey. (Works best with mid-range tones.) Then use the soft button style to create buttons to go with the interface you created. Looks nice with buttons using the same color as the interface but experiment with different colors depending on the effect you are after. The final layer style in the collection is the “Soft Indent” style which you can use to further dress up your interface. Add 1 pixel horizontal lines or 1 pixel “dots” on a new layer about the interface shape you created. It doesn’t matter what color you make these lines. They will take on the color of the underlying interface layer.