Skip to Main Content
Sustainable Web Design Logo
  • Home
  • Guidelines
  • Emissions
  • Ratings
  • Contact

◂ Web Development guidelines

3.7 Ensure code follows good semantic practices

Web Development

Use semantic markup free of optional or non-standard code, only using custom solutions when native ones are insufficient.

Criteria

  • Semantic code: Machine-testable
    Use accurate markup according to the relevant standard(s).
    • 0.5% of the Global Top 200 Websites Use Valid HTML
    • Every HTML Element
    • GPF – General Policy Framework (PDF) – 1.9 – Strategy (Interoperable Technologies)
    • GPF – General Policy Framework (PDF) – 4.5 – UX and UI (Native Components)
    • GR491 – 1-4006 – Information Over Presentation
    • How Often Should We Speak About HTML Conformance?
    • HTML: A good basis for accessibility
    • HTML5 For Web Designers
    • Is React Accessible? That’s the Wrong Question
    • Jumping HTML tags. Another reason to validate your markup
    • Mastering HTML
    • Page bloat update
    • Plain Vanilla
    • Reducing Carbon Emissions On The Web
    • Semantic HTML
    • Semantic HTML: the foundation of web accessibility
    • Semantic HTML5 Elements Explained
    • Ten years of page bloat: What have we learned?
    • Testing 10 JavaScript Frameworks on Their HTML Defaults
    • The Carbon Impact of Web Standards (PDF)
    • Understanding why Semantic HTML is important, as told by TypeScript
    • United Nations SDGS – Goal 1 – Poverty
    • W3C Validator
    • Web Accessibility Lawsuits
    • Web Standards: The What, The Why, And The How
    • What is page bloat?
    • Where Has All the Valid HTML Gone
  • Optional features: Machine-testable
    Remove optional HTML elements, attribute quotes, and default attributes when these do not negatively impact functionality, accessibility, or readability. Retain them when they enhance accessibility, maintain clarity without compromising on performance, or ensure consistent browser rendering.
    • Almost, but not quite, entirely unlike
    • Optional HTML: Everything You Need to Know
    • Some HTML is Optional
    • Stop Closing Void Elements
    • (Why) Some HTML is “optional”
    • You are not required to close your P, LI, IMG, or BR tags in HTML
  • Avoid non-standard code: Machine-testable
    Avoid using non-standard HTML elements or attributes.
    • A Node and Command Line Tool to Find Obsolete HTML
    • Non-standard elements
    • Obsolete and deprecated elements
    • Obsolete features
    • The Carbon Impact of Web Standards (PDF)
    • W3C Validator
    • Where Has All the Valid HTML Gone
    • Why Do Some HTML Elements Become Deprecated?
  • Custom code: Human-testable
    Prioritize the use of standard HTML elements and attributes. Only use custom elements or Web Components if you cannot use native elements or if you require them for the purposes of producing reusable design system components.
    • GPF – General Policy Framework (PDF) – 1.9 – Strategy (Interoperable Technologies)
    • GPF – General Policy Framework (PDF) – 2.9 – Specifications (Off-The-Shelf Components)
    • HTML First
    • Plain Vanilla
    • Web Components Basics and Performance Benefits
    • Web components vs. React
    • Why Web Components?

Benefits

  • Accessibility
    Applying semantic approaches means your content will be easier to navigate via assistive technologies and keyboard. Many tags phave native semantics, reducing the need for additional tagging. This can also help technologies to better understand your content. better.
  • Conversion
    Ensuring your code is efficient and works reduces the risk of broken features and users giving up.
  • Economic
    Conforming to accessibility legislation and regulations avoid lawsuits and fines.
  • Environment
    Following standards ensures users have a coherent experience – reducing bugs, saving time spent fixing bugs, and avoiding wasted resources. Bloated markup can otherwise lead to waste data, while broken markup can even trigger memory leaks.
  • Performance
    Clean, modern code renders better than deprecated or poorly maintained code. While Web Components do outperform framework components, they cannot outperform the native elements they are built on.

GRI

  • Materials: Medium
  • Energy: Medium
  • Water: Medium
  • Emissions: Medium

View the Guideline

Tags

AccessibilityCompatibilitySocial EquityUsabilityContentHTML

Share

More web development guidelines

3.1 Set goals based on performance and energy impact

Web Development

3.2 Remove unnecessary or redundant information

Web Development

3.3 Modularize bandwidth-heavy components

Web Development

Learn about W3C’s Sustainable Web Interest Group:

A global community advancing sustainability on the web.

Explore the group

This site is brought to you by

Mightybytes Wholegrain Digital
Website Carbon

This page loaded in 0.25 seconds and emitted just 0.5g of CO2

Visit Website Carbon
Ecograder

How green is your website?

Visit Ecograder
© Copyright Sustainable Web Design 2025. Privacy Policy.