+(44) 0845 095 6633
+(00) 1310 512 6058
0845 095 6633

CSS is Like Poetry – ‘Plan it to Perfection’

September 19, 2008 by Alexei M

The more we rely upon CSS within web design, the larger and more complex our stylesheet files (.css) become. Planning and organising your stylesheet can be compared to planning a well-written, sematically correct poem. It is this fundamental practice that is key to creating a lean, manageable website. There are many ways of organising CSS code but the following are what I believe to be ‘best practice’…

Comment your stylesheet (using /* */) for example – /* this is a comment */

By getting used to doing this, you not only create quick reference points for both yourself and others who may be accessing the same css file, but you also create a well-plnned and easily navigatable document!

References - You can also use comments as quick references for the main style guides applied throughout the website:

/* Colours
Body: #ffffff
Main Text: #000000
Link Colours: #666666
etc etc…
*/

Organisation – Comments can be used to identify the different sections of your stylesheet.

/****************Header*****************/

/****************Footer*****************/

/****************Navigation*****************/

OTHER USEFUL POINTS:

Define Main Rules & General Classes at the Top of the Stylesheet.

Order the CSS in the same order as the HTML.

Know when to use elements, IDs and Classes.

  1. Elements – Elements such as body, (<body>), paragraphs, (<p>) and headings, (<h1>,<h2><h3> etc.) should be used to define general rules.
  2. IDs - These are unique identifiers and can only be used once within your HTML document. IDs should be used to style major structural sections of a web page such as the header, footer or navigation.
  3. Classes – These can be used on any type of HTML element.

Name Classes and IDs logically. – This will SAVE TIME later!!

Group Selectors with Common CSS declarations. - This is known as ‘shorthand CSS’

  • Digg
  • Google Bookmarks
  • Technorati
  • Facebook
  • del.icio.us
  • MySpace
  • StumbleUpon
  • Sphinn
  • Reddit
  • Mixx
  • Fark
  • NewsVine
  • Live
  • Print
  • email

Related posts:

  1. Maximizing your ‘workflow efficiency’
  2. Web Design Browser Testing And Bugs.
  3. What you need on your page to make SEO work for you
  4. Using CSS Diagnotics to Check Your Web Design.
  5. Concerns over the SearchWiki Comment Function
  6. And so it begins: phase one of Yahoo’s Master Plan


No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

UK Office

Phoenix House
Pyrford Rd, West Byfleet
Surrey, KT14 6RA

Tel: +(44) 0845 095 6633

Email: sales@topclickmedia.co.uk

USA Office

Broadway Plaza
520 Broadway, Suite 350
Santa Monica, California 90401

Tel: +(00) 1 310 512 6058

Email: sales@topclickmedia.com

Resources