HTML: A Fine Art of Writing Clean Code

Neha Sharma - Jan 31 '23 - - Dev Community

HTML is an art of coding, it is the backbone of any website. Whether you are a beginner or an experienced developer, it is always possible to miss small details. In this blog, we will go through 10 important points that every developer should keep in mind while writing HTML.

These tips will help you write clean and optimized HTML code, and will work seamlessly with React, Angular, and Vue.

1. File Naming Conventions

The names of your HTML files should be in lowercase, with no spaces or special characters. The name should reflect the function of the file and should be in string format.

2. Extension Matters

Always use .html as your file extension.

3. Validate Your HTML Code

Use an HTML validator to check for any errors or issues in your code.

4. Formatting Matters

Always keep your code well-formatted, it makes your code readable and maintainable.

5. Title Tag

Use the title tag to improve accessibility for users and search engines.

6. Semantic Tags

Use semantic tags to give meaning to your HTML code. They help search engines and assistive technologies to understand the structure of your web page.

*7. Folder Structure *

A clear folder structure is a must. Create separate folders for styles, javascript, fonts, images, and other files.

8. External Styles and JavaScript

Use external CSS and JavaScript files instead of inline styles and scripts. It keeps your code clean and reduces the overall size of your HTML file.

9. Avoid Inline JavaScript Events

Avoid using inline JavaScript events, instead, use IDs or HTML elements to refer to JavaScript.

10. Optimize Your HTML Code

Always strive to optimize your HTML code, it helps to reduce the loading time of your web page and enhances the user experience.

In conclusion, writing clean HTML code is an art, and like any art, it takes time and effort to perfect. Keep these 10 tips in mind, and you will be well on your way to writing clean, optimized, and accessible HTML code.

Happy learning!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player