Validating Web Pages

Validating web page

  1. Validating web page: The concept is while we work there might be mistake/human error/typo adn so on, as a result our website may not look as expected. In this situation, we can use html validator and css validator to find the potential errors in our code.

  2. HTML Validator: Let’s run our code in a standard html validator. So we visit to https://validator.w3.org this is a standard markup validation service.

  3. Here we have 3 methods to validate html markup:

  1. Report: We directly input the code and check. This point we got; one warning, one error, and one info.

  2. Fixing codes:

<!DOCTYPE html>
<html lang="en"></html>
<body>
  <img src="images/nameera.jpeg" alt="Evening girl" />
  <p class="username">@khalid</p>
  <p>Evening sun in West</p>
</body>
<img src="images/nameera.jpeg" alt="Evening girl" />
  1. Now save the changes and check the the codes in the validator once more time and see the error resolved or not.

  2. CSS Validator: Let’s go to https://jigsaw.w3.org/css-validator/, a standard css validator service. This is the same interface as html validator. So we can validate css by address, upload file or can direct input.

  3. Separate css file: For this page we embeded all our css code inside the html markup. But when the things are complex we separated the css files so that codes becode more cleaner. For now copy the css codes and check in the validator.

Khalid

© 2024 Khalid

GitHub 𝕏