skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Archive for July, 2008

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 »

Social Networking

Keep an eye out for me on Twitter

About the Author

Steven Clark Steven Clark - the stand up guy on this site

My name is Steven Clark (aka nortypig) and my passions are business, web development, photography and writing. I have an MBA (Specialisation) and a Bachelor of Computing from the University of Tasmania. I am working as a business management consultant.

Photography

My photography is at Steven Clark Studio and my regular photo blog presents an ongoing stream of latest images at Walk a Mile in my Shoes and I'm working on a long-term photography project called the King Island Project.

Recently Reviewed Books

Site Supporters

Hosted by Brett Drinkwater at Tashosting who is always there at the other end of my every inconvenient question and technical crisis. Brett's local community support for us over the last five years is greatly appreciated.

skip to top of page

Currently Reading

Ansel Adams: The Camera

As the first of three parts of Ansel Adams Photography Series, Ansel Adams: The Camera begins by discussing the idea of visualisation in relation to photography. Ansel Adams is a master of his craft; this series has sat on my backburner for some time. Book 2 in this series is The Negative and it's followed up by The Print. In them Ansel outlines his philosophy of photography rather than trying to lay down a set of rules. This first instalment is a technical book that explains the good old fashion film camera.