HTML5 Tutorial for Beginners

Outdated Books to Avoid

If your HTML book was published before 2014, it likely teaches HTML4 or XHTML and lacks information about semantic tags, media queries, or responsive design. HTML5 simplified and standardized much of the web — use modern guides published after 2015 for best results.

Basic Structure of an HTML5 Document

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Web Page</title>
</head>
<body>
  <header>Header content</header>
  <nav>Navigation links</nav>
  <main>
    <article>Main content</article>
    <aside>Sidebar info</aside>
  </main>
  <footer>Footer information</footer>
</body>
</html>

Responsive Design and Flexible Sizing

HTML5 works beautifully with CSS3 to support responsive web design. Use percentages instead of fixed pixels to allow content to resize based on the screen. Also, use media queries to apply different styles on different screen sizes.

Top 30 HTML5 Tags with Examples

How the <canvas> Tag Works

The <canvas> tag lets JavaScript draw shapes, images, and text. You define the size in HTML and draw using JS.

<canvas id="myCanvas" width="400" height="200"></canvas>

<script>
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(10, 10, 150, 100);
</script>