Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS

JS Tutorial

JS Syntax

JS Operators

JS If Conditions

JS Loops

JS Strings

JS Numbers

JS Functions

JS Objects

JS Scope

JS Dates

JS Temporal  New

JS Arrays

JS Sets

JS Maps

JS Iterations

JS Math

JS RegExp

JS Data Types

JS Errors

JS Debugging

JS Style Guide

JS Reference

JS Projects  New

JS Versions

JS HTML DOM

JS HTML Events

JS HTML First

JS Advanced

JS Functions

JS Objects

JS Classes

JS Asynchronous

JS Modules

JS Meta & Proxy

JS Typed Arrays

JS DOM Navigation

JS Windows

JS Web API

JS AJAX

JS JSON

JS jQuery

JS Graphics

JS Examples

JS Reference


HTML-First Tutorial

What Is HTML-First?

HTML-First is a way of building websites where HTML is the foundation of the page.

A page should be readable, usable, and accessible with Basic HTML and CSS.

This approach is closely related to Progressive Enhancement.

Example

<!DOCTYPE html>
<html>
<body>
<h1>HTML First</h1>

<article>
<h2>Welcome</h2>
<p>This page works without JavaScript.</p>
</article>

</body>
</html>
Try it Yourself »

Instead of starting with JavaScript frameworks and complex client-side applications, HTML-first development starts with clean and meaningful HTML.

The content and structure of a web page should work before JavaScript is added.


Avoid Unnecessary JavaScript

JavaScript is powerful, but too much JavaScript can make websites slower and more complicated.

Many websites can be built with more HTML, CSS, and less JavaScript.

HTML-first development can help improve:

  • Page speed
  • Accessibility
  • Search engine visibility
  • Maintainability
  • Reliability

Progressive Enhancement

Progressive enhancement means starting with a working basic page.

Extra features are added only when the browser supports them.

For example, an HTML form should still work even if JavaScript fails.

Example

<form action="Action Page" method="post">
  <label for="email">Email:</label>
  <input type="email" id="email" name="email" required>
  <button type="submit">Subscribe</button>
</form>
Try it Yourself »

The form above uses built-in HTML validation and does not require JavaScript.


Why HTML-First?

HTML-first development is not about rejecting JavaScript.

It is about using the browser's built-in features before adding extra complexity.

Many common website features can be created with HTML and CSS alone.


Browsers Are Already Powerful

Modern browsers understand many useful HTML elements.

These elements can provide structure, behavior, validation, and accessibility.

Examples include <form>, <button>, <details>, <summary>, and <dialog>.

Example

<details>
  <summary>Click to read more</summary>
  <p>This text can be opened and closed without JavaScript.</p>
</details>
Try it Yourself »

Less JavaScript Can Mean Faster Pages

JavaScript must be downloaded, parsed, compiled, and executed by the browser.

Large JavaScript files can slow down the first load of a page.

This is especially noticeable on mobile phones and slow networks.

Smaller pages load faster, use less memory, and feel more responsive.


HTML Works Before JavaScript Loads

HTML is displayed as soon as the browser receives it.

This means users can often start reading the page before scripts have finished loading.

For tutorials, articles, product pages, documentation, and forms, this is often enough.


Semantic HTML Improves Accessibility

Semantic HTML uses elements for their correct meaning.

This helps screen readers, search engines, keyboard users, and other tools understand the page.

Example

<main>
  <article>
    <p>Use meaningful HTML first.</p>
  </article>
</main>
Try it Yourself »

When JavaScript Is Still Useful

JavaScript is still important for many interactive features.

The HTML-first idea is to add JavaScript when it is needed, not before.

HTML-first does not mean JavaScript never. It means HTML before JavaScript.


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.

-->