CSS Principles For Keeping Your Code Clean
Category: CSS Examples, CSS Tutorials | 898 views | 1 Comment |
1. Strict DOCTYPE
If we are going to do this, let’s just do it right. No need for a discussion about whether to use HTML 4.01 or XHTML 1.0: both of them offer a strict version that will keep us nice and honest as we write our code.
Our code doesn’t use any tables for layout anyway (nice!), so there really is no need for a transitional DOCTYPE.
Resources:
- W3C: Recommended DTDs to use in your Web document
- Fix Your Site With the Right DOCTYPE!
- No more Transitional DOCTYPEs, please
2. Character set & encoding characters
In our <head> section, the very first thing should be the declaration of our character set. We’re using UTF-8 here, which is swell, but it’s listed after our <title>. Let’s go ahead and move it up so that the browser knows what character set it’s dealing with before it starts reading any content at all.
While we’re talking about characters, let’s go ahead and make sure any funny characters we are using are properly encoded. We have an ampersand in our title. To avoid any possible misinterpretation of that, we’ll convert it to & instead.
Resources:
- CSS tricks
- What is CSS Specificity?
- Top Useful CSS Tips For Beginners
- Top CSS Mistakes Web Developers Make
- Top 15 CSS articles
- 100 CSS Examples and Tutorials
- 150 CSS Examples
- How to design css sitemap Tree
- Write a CSS Syntax
- How CSS3 works






