Let's continue from where we left. So what are comments? . Comments are those portion of HTML code which are ignored by a web browser. These are written to increase the understandability of a HTML/CSS code. Comments also help in organizing our code by putting different labels for different portions of the code.
So how do we put comments in HTML?
<!-- This is a comment.Comments are ignored by the browsers -->
//This is a single line comment in CSS.
/* This is a multi line comment in CSS.*/
We should use comments in complex codes so that other people can understand our code in a better manner.
What is validation? .Validation basically means checking your code for any errors.
In particular, an HTML validator checks to make sure the HTML code on your web page complies with the standards set by the W3 Consortium (the organization that issues the HTML standards). There are various types of validators — some check only for errors, others also make suggestions about your code, telling you when a certain way of writing things might lead to (say) unexpected results.
The W3 Consortium has its own online validator which you can use for free. It may be found at: http://validator.w3.org/
A CSS validator checks your Cascading Style Sheets in the same manner; basically, most will check them to make sure that they comply with the CSS standards set by the W3 Consortium. There are a few which will also tell you which CSS features are supported by which browsers (since not all browsers are equal in their CSS implementation).
Again, you can get free validation for your style sheets from the W3 Consortium: http://jigsaw.w3.org/css-validator/
There are numerous other validators around, both free and commercial, focusing on various aspects of ensuring that your code will run trouble-free across browsers and platforms. You can find a list of free ones (including specialized validators like those that check your code for accessibility) from Free HTML Validators, CSS Validators, Accessibility Validators at http://www.thefreecountry.com/webmaster/htmlvalidators.shtml
Note that validating your web page does not ensure that it will appear as you want in various browsers. It merely ensures that your code is without HTML or CSS syntax errors. Ensuring that your code appears correctly in different browsers require cross browser testing.
I always validate the template for my pages when I make a major design change. I try to validate my pages each time I make modifications, although I must admit that I sometimes forget to do so (with the occasional disastrous consequence; Murphy's Law doesn't spare webmasters).
I find that having an offline validator helps to make sure that I remember to validate: having to go online just to validate my pages tends to make me put off validation till later, with the result that it'll occasionally get overlooked. For those not familiar with the terminology I use, when I say "offline validator" I simply mean a validator that I can download and install in my own computer so that I can run it on my pages without having to go to the W3 Consortium's website. You can find offline validators on the free validators page I mentioned earlier, that is, http://www.thefreecountry.com/webmaster/htmlvalidators.shtml
The HTML Tidy validator (listed on that page) is available for numerous platforms (including Linux, Mac, Windows, etc) and has proven helpful to many webmasters the world over.
So how do we put comments in HTML?
<!-- This is a comment.Comments are ignored by the browsers -->
//This is a single line comment in CSS.
/* This is a multi line comment in CSS.*/
We should use comments in complex codes so that other people can understand our code in a better manner.
What is validation? .Validation basically means checking your code for any errors.
In particular, an HTML validator checks to make sure the HTML code on your web page complies with the standards set by the W3 Consortium (the organization that issues the HTML standards). There are various types of validators — some check only for errors, others also make suggestions about your code, telling you when a certain way of writing things might lead to (say) unexpected results.
The W3 Consortium has its own online validator which you can use for free. It may be found at: http://validator.w3.org/
A CSS validator checks your Cascading Style Sheets in the same manner; basically, most will check them to make sure that they comply with the CSS standards set by the W3 Consortium. There are a few which will also tell you which CSS features are supported by which browsers (since not all browsers are equal in their CSS implementation).
Again, you can get free validation for your style sheets from the W3 Consortium: http://jigsaw.w3.org/css-validator/
There are numerous other validators around, both free and commercial, focusing on various aspects of ensuring that your code will run trouble-free across browsers and platforms. You can find a list of free ones (including specialized validators like those that check your code for accessibility) from Free HTML Validators, CSS Validators, Accessibility Validators at http://www.thefreecountry.com/webmaster/htmlvalidators.shtml
Note that validating your web page does not ensure that it will appear as you want in various browsers. It merely ensures that your code is without HTML or CSS syntax errors. Ensuring that your code appears correctly in different browsers require cross browser testing.
Why Validate Your HTML Code?
The proponents of HTML validation (and CSS validation, of course) say that there are a number of reasons why you should validate your code:It Helps Cross-Browser, Cross-Platform and Future Compatibility
Although you may be able to create a web page that appears to work on your favourite browser (whatever that may be), your page may contain HTML errors (or CSS errors) that do not show up with that browser due to an existing quirk or bug. Another person using a different browser that does not share that particular bug will end up viewing a page that does not show up correctly. It is also possible that later versions of your browser will fix that bug, and your page will be broken when people use the latest incarnation of the browser.
Coding your pages so that it is correct without errors will result in pages that are more likely to work across browsers and platforms (ie, different systems). It is also a form of insurance against future versions of browsers, since all browsers aim towards compliance with the existing HTML and CSS standards.Search Engine Visibility
When there are errors in a web page, browsers typically try to compensate in different ways. Hence some browsers may ignore the broken elements while others make assumptions about what the web designer was trying to achieve. The problem is that when search engines obtain your page and try to parse them for keywords, they will also have to make certain decisions about what to do with the errors. Like browsers, different search engines will probably make different decisions about those errors in the page, resulting in certain parts of your web page (or perhaps even the entire page if your error is early in the page) not being indexed.
The safest way, it is held, is to make sure that your web page validates error-free. That way, there is no dispute about which part of your page should be scanned for keywords and the like.Professionalism
Even if you test your web site with all the various browsers in existence on all the platforms in use (Mac, Linux, Windows, FreeBSD, etc) and find that it works perfectly in all, errors in your site reflect poorly on your skill as a web developer.
The issue is two-fold: firstly, a poorly coded web page reveals that either the web designer does not know his stuff or is a sloppy worker; secondly, it affects his marketability.
Why Not Validate?
Those who are against a blanket rule about validation often cite the following reasons:Validation is No Guarantee that Page Works
Even if you validate your code, you still have to test it in the various browsers. Having code with no syntax errors does not mean that the HTML or CSS code does what you want. Hence some of the proponents of this view argue that the main goal when designing a web page is to make sure it is viewable and usable by your visitors, not some esoteric goal of standards compliance.Time Constraint for Conversion
In an ideal world, you want all your pages to be usable and error free. In the real world however, many web designers with thousands of existing pages will be hard-pressed to find time to convert all those pages so that they validate correctly. Since these pages are already doing well on the web, both with existing browsers and search engines, time is better spent doing work that is actually productive.The Average Visitor Does Not Check Your Source Code
Against the argument about professionalism is the counter-argument that the average visitor to your site is not likely to go around your site viewing the source code to your pages in an effort to locate HTML or CSS errors. To the visitor, how the page appears in his/her browser is the true test of the web designer's skill.
How Often Should I Validate?
Some people validate every time they make a modification to their pages on the grounds that careless mistakes can occur any time. Others validate only when they make a major design change.I always validate the template for my pages when I make a major design change. I try to validate my pages each time I make modifications, although I must admit that I sometimes forget to do so (with the occasional disastrous consequence; Murphy's Law doesn't spare webmasters).
I find that having an offline validator helps to make sure that I remember to validate: having to go online just to validate my pages tends to make me put off validation till later, with the result that it'll occasionally get overlooked. For those not familiar with the terminology I use, when I say "offline validator" I simply mean a validator that I can download and install in my own computer so that I can run it on my pages without having to go to the W3 Consortium's website. You can find offline validators on the free validators page I mentioned earlier, that is, http://www.thefreecountry.com/webmaster/htmlvalidators.shtml
The HTML Tidy validator (listed on that page) is available for numerous platforms (including Linux, Mac, Windows, etc) and has proven helpful to many webmasters the world over.
0 comments:
Post a Comment