• Article Written 
  • on 10.12.2009
  •  at 08:27 AM
  •  by admin

5 Simple Ways To Keep Your Code Friendly

There are thousands of blogs and tutorials websites are available on the internet but not all of the information is useful or of good quality. In this Article We’ll show you 5 ways to keep your code browser, user and search engine friendly. Keep follow this few steps, and i definitely sure that will helps you for your next website project. Enjoy it!

[ad#co-1]

5-simple-ways-to-keep-your-code-friendly

1. Write clean code

Writing clean code will be easily maintainable and less of a pain for you and others.

Bad Code

[code lang="htmlstrict"]
[/code]

Good Code

[code lang="htmlstrict"]

[/code]

2. Use the correct DOCTYPE

If you don’t use the DOCTYPE(document type declaration) tag, your Web pages won’t display in standards compliant ways and might result in some strange Web pages.

3. Use Heading Tags and Unordered lists

Use Heading Tags and Unordered lists rather then spacer graphics and nested tables..

Bad Code

[code lang=”htmlstrict”]

Heading
Content xyz
Content xyz
Content xyz
Content xyz

[/code]

Good Code

[code lang="htmlstrict"]

Heading

  • Content xyz
  • Content xyz
  • Content xyz
  • Content xyz
[/code]

4. Use semantically meaningful class & ID names

Whenever possible, use class and ID names that are semantically meaningful and search-friendly. For example:

Bad Code

[code lang="htmlstrict"]
  • Error 1
  • Error 2
[/code]

Good Code

[code lang="htmlstrict"]
  • Error 1
  • Error 2
[/code]

5. Avoid IE’s double float-margin, Use Display: inline for floated elements

Avoid IE’s double float-margin and text indent bugs by using display:inline for floated elements.

Bad Code

[code lang="css"]
#content {
    float: left;
    width: 300px;
    padding: 4px 7px;
    margin-left: 20px;
}
[/code]

Good Code

[code lang="css"]
#content {
    float: left;
    width: 300px;
    padding: 4px 7px;
    margin-left: 20px;
    display: inline;
}
[/code]

Conclusion

These are just some of the tips that help me to write better code. I hope that tutorial will also help you to write better and clean code. Apply these Tips to your current and next projects, and you will surely appreciate the efforts.

If You Think that tutorial can be more better , Please share with us. Comment us

if you would like to receive more Tips from us, please consider subscribing to our feed by RSS or by email.

Promote Us

  • Add to Mixx!
Ace Hosting India