CSS in the Real World

Paul Hart

The Image Group

Overview

Sites We've Done on GCI

Center for Church Music
http://www.songsandhymns.com/
Devos Urban Leadership Initiative
http://community.gospelcom.net/
Brix?pageID=15954
Kid's Hope USA
http://www.kidshopeusa.org/
Micah Morphosis
http://www.micahmorphosis.com/
Moments of Melody
http://www.momentsofmelody.org/
Oklahoma Wesleyan University
http://www.okwu.edu/
Follow the Rabbi
http://www.followtherabbi.com/
Western Theological Seminary
http://www.westernsem.edu/

A Foundation

XHTML & CSS basics

Proper naming and crawling techniques

Put nav at bottom of document

Ids vs. classes

id
<div id="content">
#content in CSS
used only one time
can be accessed with anchors
great javascript hook
class
<div class="navigation">
.navigation in CSS
used many times

Blocks vs. Inline elements

Block
h1, h2, h3, div, p, img, blockquote, ul, ol, table
Can have margins applied
Can contain inline elements
Can be turned into inline with diplay:inline;
Inline
a, span, em, q, abbr
Can't have margins applied
Cannot contain block level elements
Can be turned into block with diplay:block;

Floats vs. Positioning

http://complexspiral.com/publications/containing-floats/

Tips & Tricks

Multiple background images

Example

Crop images with CSS

Crop sample A

Crop sample B

Turn text into an image

This is actually an image

  • p.imageexample
    { margin: 0; height: 0px !important; line-height: 105px; overflow: hidden; background: transparent url(pix/sunset-horiz.jpg) left top no-repeat; width: 480px; padding: 105px 0 0 0; height /**/:105px; /* For IE 5 browsers */ }
  • p.imageexample a {
    display: block; width: 500px; height: 105px; text-indent: -1000em; border: none; text-decoration: none; }

Container div

Horizontal Navigation

Example

http://www.moronicbajebus.com/playground/cssplay/hormenu/

Image mouseovers as one image

Example

Leveraging media types

Fluid box with rounded corners

Example

Use alternate stylesheets

Example

Layer Switching

Example

Background image rotation

Using PHP

Example

Working with browser bugs

Box model problem

http://www.info.com.ph/~etan/w3pantheon/style/modifiedsbmh.html

Doubled margin bug

http://www.positioniseverything.net/explorer/doubled-margin.html

Flash of Unstyled Content (FOUC)

Thank You

http://www.imagegroup.com/resources/