1. Start with <!DOCTYPE html>, followed by the <html> tag.
<!DOCTYPE html>
<html>
2. Use semantic tags like <header>, <footer>, <section>, <main>, <nav>, etc. when appropriate.
<header>
<footer>
<section>
<main>
<nav>
3. Always include <meta charset="UTF-8"> in your <head> tag for proper text rendering.
<meta charset="UTF-8">
<head>
1. Use a 2-space indent for nested elements.
1. Use lowercase for tags, attributes, and file names.
2. Separate words in ID and class names by a hyphen.
1. Always close tags. For tags that don’t have a closing pair, like <img>, <br>, etc., close them self, e.g., <img src="image.jpg" alt="Image" />.
<img>
<br>
<img src="image.jpg" alt="Image" />
2. Use double quotes around attribute values.
3. Avoid inline CSS when possible. Prefer linking to an external stylesheet.
1. Always include alt attributes for accessibility and in case the image fails to load.
alt
2. Use CSS for backgrounds rather than images, when possible.
1. Use comments to explain the code and keep them updated with the code.
Last updated 2 years ago