HTML is undoubtedly an indispensable component of every web development project. The better the quality of HTML Code, the better would be the overall quality of the final product. This is the reason behind the html inspector.
Ensuring consistency throughout the markup is perhaps the most critical aspect that needs special consideration by developers whore working on the project.
Fortunately, today, we have an easy access to multiple tools that can be used for enhancing the quality of markup in a simple and convenient way.
HTML Inspector is the tool that Ill be talking about in this post. So, keep on reading as Ill be unveiling some vital aspects related to this awesome tool.
A quick overview on HTML Inspector
The fully customizable nature of HTML Inspector makes it quite flexible for you to use what you like and ignore the things you hate about your code.
Additionally, HTML Inspector is fully extensible and pluggable, allowing you to write your own rules for enforcing the coding conventions chosen by you.
HTML Inspector- A brief on Installation
If youre performing testing on your non-production code, then you can simply include the HTML Inspector script within the pages, towards the bottom and finally run the same by calling the primary method. The lines which you need to add right before the closing tag include the ones shown below:
<! Include jQuery if it has been loaded already >
On the other hand, if youve chosen to download HTML Inspector manually, you simply need to grab a copy of html-inspector.js from projects root directory, include it in within the bottom of the document and finally execute it as shown below:
On the contrary, if you arent customizing the script, you can easily run HTML Inspector on a remote or local website, in any browser which has developer tools installed. For this, all you need to do is simply open the browsers developers tools console and run the below displayed commands:
var htmlInsp = document.createElement(script);
htmlInsp.src = //cdnjs.cloudflare.com/ajax/libs/html-inspector/0.8.1/html-inspector.js’;
Once youve executed the above commands, just run the following command in your console:
Some handy suggestions on writing custom rules that can be plugged into HTML Inspector
You need to put in additional amount of effort into writing custom rules that will further be incorporated into HTML Inspector. Here are some suggestions for coming up with absolutely brilliant rules:
1. Paying special attention to HTML5 element usage
With HTML5 elements having a specific semantic meaning of their own, it is better to keep a good account of the same while writing rules to warn the web developers.
For example, the HTML element will inform the developers that
2. Ensuring the website is accessible for people with disabilities
In order to ascertain the sites accessibility for the disabled population, you can opt for the role attributes and proper ARIA.
Plus, you can also opt for ensuring that the text is legible enough for people who lack the eyesight of a young designer. For this, just make sure to use a large text size or a high contrast ratio.
3. Keeping Conventions in place
A lot of web development projects make it a point to enforce and keep the naming conventions consistent throughout the website.
If youve framed project-wide naming conventions for IDs, classes or attributes, then you can easily grab the opportunity for writing a custom rule.
For instance, if you want all your classes and attribute names to use dashes instead of camelCase or underscores, then you can simply inform the developers about this particular convention.
Despite the fact that HTML Inspector expects you to work with a modern browser, this tool definitely serves as the right option for detecting everything unexpected that has happened to your sites markup.