• 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

June 12th, 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.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook

Related

Facebook Twitter Google+ LinkedIn Pinterest
Next article How to Download YouTube Video with PHP

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

7 HTML attributes that you must learn today! HTML 5
June 19th, 2025

7 HTML attributes that you must learn today!

Cool HTM5 Features, Part 2 HTML 5
June 16th, 2025

Cool HTM5 Features, Part 2

Cool HTML5 features HTML 5
June 15th, 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
  • 9 Best Programming languages you should learn in 2021
  • What is Progressive Web Applications and Why Create a PWA?
  • 7 HTML attributes that you must learn today!
  • Why Use MongoDB and When to Use It?
  • Introduction to Git for version control
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
  • How to
  • javascript
  • laravel
  • MYSQL
  • PHP framework
  • css
  • jQuery
  • HTML to PDF
  • Web Development
  • About
  • Privacy Policy
  • Back to top
© PHPLift.net. All rights reserved.