• Home
  • PHP
  • MySQL
  • Laravel
  • Demos
  • HTML
  • jQuery
  • Framework
  • Request Tutorial
PHP Lift
  • Home
  • Demos
  • Advertisement
PHP Lift
  • Home
  • PHP
  • MySQL
  • Laravel
  • Demos
  • HTML
  • jQuery
  • Framework
  • Request Tutorial
  • Follow
    • Facebook
    • Twitter
    • Google+
    • Pinterest
    • Youtube
    • Instagram
    • RSS
Validation of HTML5 documents
Home
HTML 5

Validation of HTML5 documents

October 26th, 2025 Ivan Dimov HTML 5 0 comments

Facebook Twitter Google+ LinkedIn Pinterest

When creating pages, it is important for your website to be valid. That means there should be no errors in the HTML code of your webpages. This is not mandatory but it will provide a boost for your website; both in terms of consistency and search engine rankings.

  1. HTML5 documents start with the <!DOCTYPE html> declaration which is much shorter than previous versions such as XHTML and HTML 4.
  2. You don’t have to close void tags with a slash: you can just input <br> instead of <br /> if you desire
  3. Attributes need quotation signs only if there is a space in the attribute or other special characters such as an equals sign.
  4. Elements and attributes can be arbitrarily-cased (they could be in lowercase, uppercase or mixed case) and that would not be a problem.
  5. Some attributes and tags were deprecated in HTML5 so you should keep yourself from using them, such as the attributes target, scope, align, bgcolor, border, background, cellpadding, cellspacing and so on. You can get a full list of deprecated attributes and tags at: https://www.tutorialspoint.com/html5/html5_deprecated_tags.htm
  6. You should be okay if you put ampersands (&) as text on a page instead of writing them as an entity (&amp;)
  7. Void tags need not be closed; make sure you close all other tags that need a closing pair, like <p>…</p>
  8. In fact, you can add an arbitrarily named tag or attribute in HTML5 and the browser will render the page but the tags/attributes may not constitute a valid HTML5 document. A custom HTML5 element must have a dash in its name and you should be using the data attribute for arbitrary attributes instead of just inserting arbitrary attributes.
  9. The alt attribute for images (<img>) is still required
  10. Do not place block-level elements such as <p> inside inline-level elements such as <button>
  11. Identifiers (id attributes) and class names should not contain a whitespace inside their name.
  12. Avoid duplicate declaration of attributes on the same element
  13. You should close all non-void tags, closing the container tag without closing one of its children will still result in a validation error.

You can validate your pages one at a time at: https://validator.w3.org/. The validator will show the actual errors so that you can see what is wrong and resolve it. Therefore, it might be good to validate the documents regularly while your websites are in development. As usual, the errors are of the highest importance.

Facebook Twitter Google+ LinkedIn Pinterest
Next article Simple PHP REST API with Slim, PHP & MySQL
Previous article Javascript let vs var

Ivan Dimov

Ivan is a student of IT, a freelance web designer/developer and a tech writer. He deals with both front-end and back-end stuff. Whenever he is not in front of an Internet-enabled device he is probably reading a book or traveling. You can find more about him at: http://www.dimoff.biz. facebook, twitter

Related Posts

Javascript Image Compress using HTML5 Canvas & File API before Upload HTML 5
October 30th, 2025

Javascript Image Compress using HTML5 Canvas & File API before Upload

Cool HTM5 Features, Part 2 HTML 5
October 29th, 2025

Cool HTM5 Features, Part 2

Cool HTML5 features HTML 5
October 29th, 2025

Cool HTML5 features

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe
Get new posts by email:
Powered by follow.it
Advertisement
Like us
Recent Posts
  • Create HTML5 Fullscreen Static Video Background Using CSS
  • 10 Best Food Delivery Apps Systems for Small Restaurants
  • Sanitizing input with PHP and JavaScript
  • Examining variable types in PHP
  • Create Bootstrap form wizard and validation with jQuery
Categories
  • API
  • Bootstrap
  • Bot
  • CSS
  • CSS 3
  • Database
  • Designing
  • Framework
  • Guide
  • HTML
  • HTML 5
  • JavaScript
  • jQuery
  • Laravel
  • MySQL
  • Node.js
  • oAuth
  • Payment
  • PHP
  • Python
  • Social
  • Tips
  • Web 3.0
  • WordPress
Weekly Tags
  • PHP
  • javascript
  • How to
  • laravel
  • css
  • HTML to PDF
  • jQuery
  • api
  • Web Development
  • MYSQL
  • About
  • Privacy Policy
  • Back to top
© PHPLift.net. All rights reserved.