When you start learning coding and web designing in HTML, you basically begin with normal HTML markup. Laying out a page, adding colors, buttons, images etc are just the basic part you never skip to design your page.
Let’s discuss what those 7 things are.
Make your code human readable
Because you are a HTML beginner, you are never going to use any HTML editing software like Dreamweaver, FrontPage, etc. are you? You literally start with a NOTEPAD or similar text editor and start coding but have you ever thought that you need revise your HTML markup sometime?
In the image below can you easily find the parent tag or its order?
The answer to the question is probably no if you are a beginner. Because such type of coding is just easily readable by the browser not the user. You must make it clearly readable by yourself so that you can easily find the section you are looking for in future modification.
Though the HTML tags are enclosed in “<” and “>” our brain cannot easily distinguish it from other character easily in such a huge crowd. Instead you can use CAPITAL LETTERS to rectify the HTML tag out of the web contents.
Look how the tags are distinguishable from the text contents.
Other thing you can do is make a tree order so that you can easily find the parent or child of the tag easily. This can be done by leaving some space from the right. See the example image below for more clarification.
This trick will make you easy to edit and look for the exact tag when necessary.
Using of HTML comments wisely
It is not much necessary to use HTML comments because, HTML comments are for users and browser doesn’t render it in its window. The necessity of HTML comments rises when your HTML markup goes more complex and complex. In such case using of HTML comments is necessary. As we’ve already discussed about human readability of the code in first step.
The HTML comments start with “” everything between the start and end code is not rendered in browser screen but you can easily find the it in it’s source.
Always close the tag
I understand you know this fact, but when the codes get complicated with larger contents and lots of inner divisions and blocks you’ll get confused in the middle of the path. Basically, when you view the HTML page that have unknown incomplete tags, the contents will be visible with no errors. But incase if you have added some CSS styling and tables to your web design layout you’ll probably have lots of error and fault in proper rendering in such unknown incomplete tags. Therefore ending a tag is most important thing.
Even though you are aware about it you miss to close the tag because we cannot always remember which tag was opened first and which was at last. But there is a trick (or say tips) that you can apply to have your HTML tags complete one.
Whenever you begin for a new HTML tag, close it immediately after the opening of tag.
For example, look at the sample coding below. The tag is closed instantly after it’s opening.
Then you can start filling the contents and other sub tags inside it.
Always provide alternate text for the image
This trick though won’t affect your coding, user readability or browser render-ability, it is recommended that you use alternate tags.
The above tag renders a image file named image.jpg from the specified source. But incase if you don’t have the image in specified location or mistakenly deleted the image file it will render nothing (in some browser it will show image icon or red cross icon).
Remember how important the image can be to the web page visitor. To understand your contents, S/he must know what the image was about. You must use alternet text what will show up when browser is unable to locate your image file. This will at least give the imaginative picture of the unknown image.
Proper sequence of Headers
H1 is the first and largest header of your HTML document. If you use header (H1, H2, H3) tags you must use it in sequence. For example,