skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Archive for the 'css' Category

External, Embedded and Inline CSS

Sunday, July 27th, 2008

Understanding where to put your CSS (Cascading Stylesheets) rules requires an understanding of the three alternatives at your disposal.

  1. External Stylesheets - called by @import or link elements
  2. Embedded Styles - placed between style tags in the document
  3. Inline Styles - placed directly into the element itself

Best practice web standards development methodology is to use, in nearly every single instance, external stylesheets to deliver your CSS rules to a page. This allows a separation of content (XHTML or HTML) from presentation (CSS) across the whole project. The real power of this is that you can then maintain your presentation / design, and even redesign, without touching the potentially huge number of content pages of your website. Using a set of stylesheets which take advantage of the cascade, inheritance and specificity will give you a robust and powerful development methodology. Calling an external style sheet (number 1) is as simple as placing the following link element in the head of your document.

<link rel="stylesheet" type="text/css" href="styles.css" />

However, CSS can be placed into the document itself either embedded between style tags (number 2) or directly inline (number 3) on an element itself. This automatically breaks the separation of content from presentation and it is highly ill-advised to make either of these an ongoing strategy for delivering your CSS.

Read the rest of this entry »

skip to top of page

Currently Reading

Information and Data Modelling (Second Edition) by David Benyon (Cover)With an eye toward implementing another web interface database solution from the ground up I'm casually revisiting David Benyon's Information and Data Modelling (Second Edition). Its critical to have a solid understanding of conceptual data modelling and knowing how to identify various things like fan traps and three way traps very early in the process. To that end, while its fine to have a basic understanding of third normal form and general ideas about relations (that which relational databases rely on), its also a great idea to spend time exploring the theory and case studies that lead to a higher understanding.

Often people I deal with just snuff their nose and say they can design a database - but often its a very naive approach. Having read this book about four years ago its time for a quick refresher over my holiday period. No, I doubt few will envy me.