HTML Examples Library

69 examples · all runnable online, source viewable, free to download

Application-level HTML examples — more than syntax demos: complete, ready-to-use pieces with polished UI and combined fundamentals. Preview live, copy the source, or download every example. Pair it with the HTML tutorial and reference manual for systematic learning.

Category:
User Login Form
User Login FormBuild a complete user login form with HTML and CSS: email/password inputs, a remember-me checkbox, and a submit button. Run it online or download the ZIP source for free.⚡ Intermediate#form#input#label
Native Form Validation
Native Form ValidationAn HTML native form validation example: required/pattern/minlength checks plus :user-invalid state styling. The browser blocks invalid submissions with zero JS.🔥 Advanced#input#form#button
Registration Form
Registration FormAn HTML multi-field registration page example: text inputs, a grouped optgroup select, a fieldset radio group, a terms checkbox, and a submit button. Run online, download free.⚡ Intermediate#form#select#input
Survey Form UI
Survey Form UIAn HTML survey form example: fieldset groups, radios, checkboxes, a rating scale, and a textarea. Pure semantic HTML, run online, download free.🔥 Advanced#form#fieldset#legend
Dropdown Navigation
Dropdown NavigationAn HTML dropdown navigation example: a nav element with nested ul lists, a CSS :hover / :focus-within submenu, zero JS. Run online, download free.⚡ Intermediate#nav#ul#a
Podcast Audio Page
Podcast Audio PageAn HTML podcast page example: native audio controls plus a past-episodes list layout. Listen online, download the ZIP source for free.⚡ Intermediate#audio#source
Responsive Gallery
Responsive GalleryAn HTML responsive gallery example: a figure/figcaption semantic gallery on an auto-fill grid with descriptive alt text. Run online, download free.⚡ Intermediate#figure#img#picture
Video Player Page
Video Player PageAn HTML5 video player page example: multiple video sources for webm/mp4 compatibility, native controls, and a track subtitle rail. Run online, download free.⚡ Intermediate#video#source#track
HTML-Only Accordion
HTML-Only AccordionA pure-HTML accordion example: details/summary collapsible panels with zero JavaScript. Run online, download the ZIP for free.⚡ Intermediate#details#summary
Native Dialog Modal
Native Dialog ModalA real modal built on the native dialog element: showModal() traps focus inside, Esc closes it and ::backdrop paints the overlay for you. The confirm buttons use form method="dialog" to return a value — no libraries involved.⚡ Intermediate#dialog#form#button
Progress Dashboard
Progress DashboardAn HTML progress dashboard example: progress and meter semantics plus a stat-card layout. Run online, download free.🔥 Advanced#progress#meter#output
Search with Datalist
Search with DatalistAn HTML datalist search example: native input suggestions on an input element, zero-JS city search. Run online, download the ZIP source for free.⚡ Intermediate#datalist#input#option
Accessible FAQ Page
Accessible FAQ PageAn HTML FAQ help page example: details Q&A panels and semantic grouped sections forming a ready-to-use help center template.⚡ Intermediate#details#article#section
Resume CV Page
Resume CV PageAn HTML resume page example: header, main, section, article, time, and address semantic tags forming a complete resume template.🎯 Full Project#article#header#section
Course Timetable
Course TimetableAn HTML course timetable example: caption, colgroup, thead/tbody/tfoot, and rowspan working together to recreate a real weekly schedule.⚡ Intermediate#table#thead#tbody
Pricing Table
Pricing TableAn HTML pricing table example: thead/tbody/tfoot grouping, scope attributes, and a highlighted recommended column. Run online, download free.⚡ Intermediate#table#colgroup#th
Staff Schedule
Staff ScheduleAn HTML staff schedule example: rowspan for team blocks and colspan for shared days off, showing how complex table data is structured. Run online, download free.⚡ Intermediate#table#caption#td
Anchor Fragment Navigation
Anchor Fragment NavigationSticky left-TOC + right content, native href="#id" anchors, IntersectionObserver highlights current section⚡ Intermediate#a#nav#section
Contact Block with Native Link Protocols
Contact Block with Native Link Protocolsmailto + tel + sms + download + external link — five native protocols, browser opens matching app⚡ Intermediate#a#address
External Link Safety — rel noopener noreferrer
External Link Safety — rel noopener noreferrertarget=_blank must get rel="noopener noreferrer" to prevent window.opener hijack + hide referrer. download attribute forces save-as.🔥 Advanced#a#links
Semantic Breadcrumb Navigation
Semantic Breadcrumb Navigationnav aria-label + ol (ordered position) + li[aria-current=page] + BreadcrumbList JSON-LD for search-engine rich snippets⚡ Intermediate#nav#ol#li
Skip Link — Keyboard-First Navigation
Skip Link — Keyboard-First NavigationTop of body, visually-hidden but focus-visible, href=#main + main tabindex=-1 — the a11y win most commonly missed🔥 Advanced#a#main#nav
Seven Landmarks — Full Article Page
Seven Landmarks — Full Article PageAll seven semantic landmarks on one page, with Schema.org BlogPosting structured data🎯 Full Project#header#nav#main#article#footer
Blog Post Template with figure, time, Schema.org
Blog Post Template with figure, time, Schema.orgarticle whole-page + figure/figcaption hero + time datetime publish date + itemscope BlogPosting⚡ Intermediate#article#figure#time
Definition List — HTML Glossary
Definition List — HTML Glossarydl/dt/dd three-step definition list + dfn term + nested dl for multi-meaning terms — alternative to tables⚡ Intermediate#dl#dt#dd
Quotes and Citations — blockquote, q, cite, abbr
Quotes and Citations — blockquote, q, cite, abbrFour quote elements with distinct jobs: blockquote=long, q=short inline, cite=source, abbr=abbreviation⚡ Intermediate#blockquote#q#cite
Auto-Synchronized Heading Outline Tree
Auto-Synchronized Heading Outline TreeScript walks h1-h6 to build indented tree, IntersectionObserver highlights current heading, deliberately shows a second h1 as a bad example🔥 Advanced#h1#section#article
Fieldset + Legend + Label Grouped Form
Fieldset + Legend + Label Grouped FormMulti-fieldset grouping with legend naming + label-for binding, radio wrapped in label for click-anywhere selection⚡ Intermediate#fieldset#legend#form
Grouped Dropdown with optgroup
Grouped Dropdown with optgroupNative optgroup renders bold group headings in-browser — zero JS, zero custom UI, long dropdowns are readable⚡ Intermediate#select#optgroup#option
Output Element — Live Calculation
Output Element — Live CalculationThree range sliders + <output> live volume display, output with for attribute listing dependent inputs, announced as live region by screen readers⚡ Intermediate#output#form#input
Meter — Native Gauge
Meter — Native Gaugemeter renders native gauge auto-colored via low/high/optimum — green/yellow/red tiers; CSS cannot change its internal striping⚡ Intermediate#meter#native-widgets
Progress — Task Tracker
Progress — Task Trackerprogress with max+value = determinate, no value = indeterminate animated strip. meter shows a value in a known range, progress shows task completion⚡ Intermediate#progress#native-widgets
Details — Single Foldable FAQ
Details — Single Foldable FAQMultiple independent <details>/<summary> blocks for FAQ pages — each folds and unfolds on its own.🌱 Beginner#details#summary
Menu — Semantic Navigation
Menu — Semantic NavigationThe semantic <menu> element for interactive navigation and action lists.⚡ Intermediate#menu#native-widgets
Noscript — JS-Dependent Site Fallback
Noscript — JS-Dependent Site FallbackGraceful fallback content when JavaScript is disabled — not just 'please enable JS'.🌱 Beginner#noscript#script
Dialog — Native open Attribute
Dialog — Native open AttributeNative <dialog> modal with static open attribute and ::backdrop styling — pure HTML.⚡ Intermediate#dialog#button
Colgroup — Column Layout Control
Colgroup — Column Layout ControlUse <colgroup> with <col> to control column width, alignment, and styling from one place.⚡ Intermediate#colgroup#col
Rowspan — Complex Grid Merge
Rowspan — Complex Grid MergeRowspan merges cells downward across multiple rows — great for schedules, grade books, and rosters.⚡ Intermediate#tr#tables
Accessible Table — Headers &amp; Scope
Accessible Table — Headers &amp; ScopeUse scope, id, and headers attributes so screen readers know which headers belong to each cell.🔥 Advanced#th#td
Picture — Responsive Art Direction
Picture — Responsive Art DirectionProvide different source images at different breakpoints — not just different resolutions, but different crops or subjects.⚡ Intermediate#picture#source
Audio — Subtitle Track
Audio — Subtitle TrackAdd captions, descriptions, and chapters to <audio> and <video> with <track> — no JavaScript needed.🌱 Beginner#audio#track
Video — Poster &amp; Preload
Video — Poster &amp; PreloadConfigure poster thumbnail, preload behavior, and controlsList for a well-behaved <video> element.🌱 Beginner#video#source
Aside — Sidebar Callouts
Aside — Sidebar CalloutsTangential content boxes: definitions, tips, and warnings that can be removed without breaking the main narrative.🌱 Beginner#aside#semantic-layout
Figure — Semantic Image Group
Figure — Semantic Image GroupGroup self-contained content (images, code blocks, quotes) with <figure> and its caption <figcaption>.🌱 Beginner#figure#figcaption
hgroup — Title with Subheading
hgroup — Title with SubheadingGroup a primary heading with subtitle/byline so outline tools treat them as one heading unit.🌱 Beginner#hgroup#semantic-layout
Textarea — Multi-Line Input
Textarea — Multi-Line InputCaptures multi-line input with rows/minlength/maxlength attributes. Use CSS min-height for baseline height.🌱 Beginner#textarea#forms
Template + Slot — Declarative Templating
Template + Slot — Declarative TemplatingLearn how <template> holds inert HTML fragments and <slot> marks dynamic insertion points — the declarative core of Web Components.🌱 Beginner#template#slot
Data Attributes + CSS — State Without JS
Data Attributes + CSS — State Without JSCustom data-* attributes store metadata on any element. CSS attribute selectors react to them — zero JavaScript for pure presentation toggles.🌱 Beginner#div#li
Time — Semantic Date/Time
Time — Semantic Date/TimeMark up dates and times with the <time> element and its datetime attribute — browsers, search engines, and calendars all read it.🌱 Beginner#time#semantic-layout
Address — Contact Semantics
Address — Contact SemanticsThe <address> element marks up contact info for an article's author or an organization — not a generic mailing address box.🌱 Beginner#address#semantic-layout
HR — Thematic Break
HR — Thematic BreakUse <hr> to mark thematic shifts between paragraphs — not just a decorative horizontal rule.🌱 Beginner#hr#section
Small — Side Comments & Legal Text
Small — Side Comments & Legal TextThe <small> element represents side comments, fine print, and legal disclaimers — content that's secondary but still readable.🌱 Beginner#small#semantic-layout
Text Emphasis — strong, em, b, i, s, u
Text Emphasis — strong, em, b, i, s, uSix inline elements for text styling — not all are equal. Learn when to pick semantic strong/em over presentational b/i.🌱 Beginner#strong#em#b#i#s#u
ins / del — Track Changes
ins / del — Track ChangesMark edits with <ins> and <del>, optionally cite the source and datetime. Screen readers and search engines understand these elements natively.🌱 Beginner#ins#del
abbr / dfn / var — Definitions & Variables
abbr / dfn / var — Definitions & VariablesThree specialized inline elements: <abbr> for expandable abbreviations, <dfn> for defining instances, and <var> for mathematical variables.🌱 Beginner#abbr#dfn#var
kbd / samp / code / pre — Computer Output
kbd / samp / code / pre — Computer OutputFour elements for computer-related text: keyboard input, program output, code fragments, and preformatted blocks — each with distinct semantics.🌱 Beginner#kbd#samp#code#pre
bdi / bdo — Bidirectional Text
bdi / bdo — Bidirectional TextHandle mixed RTL/LTR text correctly. <bdi> isolates unknown-direction runs; <bdo dir="rtl"> forces direction when the algorithm gets it wrong.⚡ Intermediate#bdi#bdo
ruby / rt / rp — Pronunciation Annotations
ruby / rt / rp — Pronunciation AnnotationsAttach pronunciation hints above text with <ruby>, <rt>, and <rp> — furigana, pinyin, hangul, and IPA annotations.⚡ Intermediate#ruby#rt#rp
iframe — Sandboxed Embeds
iframe — Sandboxed EmbedsEmbed pages safely with <iframe sandbox="..."> — grant only the permissions you need, everything else is blocked by default.⚡ Intermediate#iframe#media
embed / object / param — Legacy Plugins
embed / object / param — Legacy PluginsThe legacy plugin-embedding trio — mostly superseded by <video>, <audio>, and sandboxed iframes, but still useful for SVG with fallback.⚡ Intermediate#embed#object#param
Heading Hierarchy — h1 through h6
Heading Hierarchy — h1 through h6Six heading levels build your document outline. One h1 per page, nest consecutively (h1→h2→h3). Headings are for structure, not just typography.🌱 Beginner#h2#h3#h4#h5#h6
Paragraphs &amp; Line Breaks — p vs br
Paragraphs &amp; Line Breaks — p vs br<p> wraps one or more sentences into a semantic paragraph block. <br> forces a line break inside a paragraph without starting a new one.🌱 Beginner#p#br
span — Inline Style Container
span — Inline Style ContainerThe generic inline container for styling text where no semantic element (em, strong, abbr) fits. Reach for span last.🌱 Beginner#span#semantic-layout
sup / sub — Superscript &amp; Subscript
sup / sub — Superscript &amp; Subscript<sup> marks superscript (above baseline): math powers, footnotes, ordinals. <sub> marks subscript (below): chemical formulas, log bases, variable indices.🌱 Beginner#sup#sub
mark — Highlighting Text
mark — Highlighting Text<mark> indicates text relevant to the user's current activity — search hits, filtered content, or annotated quotes. Not just a yellow background.🌱 Beginner#mark#semantic-layout
wbr — Soft Word Break Opportunity
wbr — Soft Word Break Opportunity<wbr> suggests a break point to the browser without inserting a hyphen. Perfect for long URLs, camelCase identifiers, and compound words.🌱 Beginner#wbr#semantic-layout
data — Machine-Readable Values
data — Machine-Readable Values<data value="..."> associates a machine-readable value with human-readable text — ratings, prices, stock codes. For dates and times use <time> instead.⚡ Intermediate#data#semantic-layout
Complete Table — thead / tbody / tfoot
Complete Table — thead / tbody / tfootThe full table model with all three sections. <tfoot> renders at the bottom regardless of source position — great for totals, averages, and printed tables with repeated headers/footers.⚡ Intermediate#tfoot#tables
Image Map — map & area Hotspots
Image Map — map & area HotspotsThe legacy image-map duo — <map> + <area> turns any image into clickable regions. Mostly superseded by clickable SVG, but still useful for non-SVG graphics (photos, legacy diagrams) where slicing would be wasteful.🌱 Beginner#map#area
No examples at this difficulty in this category

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏