Three layers of web
- Content Layer – HTML
- Presentation Layer – CSS
Keeping your code in three different layers is a good idea because it makes your code more readable, can easily maintain it in the long run, reuse the code in other projects. One more reason is that people who visit your website may read content using different browsers, mobile and handheld devices, rss feeds so many time you may want to send only the content part leaving back the design and behaviour.
Content Layer – HTML
While writing the HTML code never forget the KISS principle (Keep It Simple, Silly). Never mix the HTML code with non-content information.
To make sure your code is readable, keep all the layers seperate
The old tags like <font>,<b>,<u>,<i> that describes how the content should look like when its displayed in the browser is a part of non-content information because controlling how your content should look like in browser must always be handled by the presentation layer i.e. CSS
Presentation Layer – CSS
The content of page should entirely be in HTML and it styling should be specified in CSS code that is applied to the page. CSS can be used in three ways
Inline style messes your html code. So it is surely not the way go.
Embedded style keeps your code clean but it ties your css code in a single file. Many times you may want to share the css across multiple pages.
external surely is the real way to go. It keep your html and css separate and you can share your css code across many pages.