Top Tips For Writing HTML

Posted by Bhavesh Joshi On Wednesday, May 16, 2012 0 comments
HTML DocumentAlthough rich content sites using PHP, JavaScript and other newer programming languages are very popular, (X)HTML is still the most favourable scripting language to learn for most new web developers. 

Understanding it gives you an idea of how other web languages work, and will stand you in good stead for learning your trade.

Note: Whenever HTML is mentioned in this article, it should be understood to mean both HTML 4/5 and XHTML 2.0.

1. Use An Environment That Lets You See Errors

As a newer programmer, it can be frustrating to see that your website isn't parsing correctly and having no idea of how to fix it. Sometimes it's something as simple as a botched closing tag, or you may just not have used the correct syntax, confusing the engine and leading to a buggy implementation. Having a way to see exactly what you did wrong and where, is absolutely invaluable in your formative years, and not to be sniffed at.



When you've found one, be sure to take a look at whether it automatically corrects errors or just alerts you to their presence. It's not very useful when, every time you make a mistake, it changes it silently without letting you know what you did wrong.



2. Always Attempt A Project Slightly Too Hard

With the new HTML specifications just around the corner, having an understanding of how they'll work ahead of the curve could give you a massive edge in the marketplace. Every time you try something you can't quite complete, you're forced to adapt and learn the skills necessary, so take advantage of that.



3. Structure Your Code

Having a solid structure to your code work makes it so much easier as the application grows in size. There is nothing worse than hunting for a closing tag or not being completely sure what does what because the code is all on one line. Make use of indentation, and always order your tags to open and close in a set order. The use whatever methodology you please; just make sure there is some form of similarity between all of your projects.



4. Leave Comments For Your Future Self

In a similar vein, leaving comments in your code is something that may seem tedious at the time, but you'll hug yourself 6 months down the line when it comes to the time to audit your code. Knowing exactly why you've done something in the way you have is an incredible feeling, and saves more time than you'd ever imagine. They don't all need to be of essay length, so just a few words here and there are enough to get the job done.



5. Get Rid Of Any Internal Styling Unless You Have A Reason To keep it

CSS (cascading style sheets) are one of those simple ideas that makes a lot of sense, and questions how we ever got by without it. For the uninitiated, a CSS file contains all of the styling needed to make the website look pretty, and give you a place to put it which is out of the way of the rest of the code. Not having to write dozens of statements every time you want blue text should be reason enough.

0 comments:

Post a Comment