Movatterモバイル変換


[0]ホーム

URL:


Menu
×
See More 
Sign In
+1 Get Certified Upgrade For Teachers Spaces Get Certified Upgrade For Teachers Spaces
   ❮     
     ❯   

HTML Tutorial

HTML HOMEHTML IntroductionHTML EditorsHTML BasicHTML ElementsHTML AttributesHTML HeadingsHTML ParagraphsHTML StylesHTML FormattingHTML QuotationsHTML CommentsHTML ColorsHTML CSSHTML LinksHTML ImagesHTML FaviconHTML Page TitleHTML TablesHTML ListsHTML Block & InlineHTML DivHTML ClassesHTML IdHTML ButtonsHTML IframesHTML JavaScriptHTML File PathsHTML HeadHTML LayoutHTML ResponsiveHTML ComputercodeHTML SemanticsHTML Style GuideHTML EntitiesHTML SymbolsHTML EmojisHTML CharsetsHTML URL EncodeHTML vs. XHTML

HTML Forms

HTML FormsHTML Form AttributesHTML Form ElementsHTML Input TypesHTML Input AttributesInput Form Attributes

HTML Graphics

HTML CanvasHTML SVG

HTML Media

HTML MediaHTML VideoHTML AudioHTML Plug-insHTML YouTube

HTML APIs

HTML Web APIsHTML GeolocationHTML Drag and DropHTML Web StorageHTML Web WorkersHTML SSE

HTML Examples

HTML ExamplesHTML EditorHTML QuizHTML ExercisesHTML WebsiteHTML SyllabusHTML Study PlanHTML Interview PrepHTML BootcampHTML CertificateHTML SummaryHTML Accessibility

HTML References

HTML Tag ListHTML AttributesHTML Global AttributesHTML Browser SupportHTML EventsHTML ColorsHTML CanvasHTML Audio/VideoHTML DoctypesHTML Character SetsHTML URL EncodeHTML Lang CodesHTTP MessagesHTTP MethodsPX to EM ConverterKeyboard Shortcuts

HTMLAccessibility


HTML Accessibility

Always write HTML code with accessibility in mind!

Provide the user a good way to navigate and interact with your site. Make your HTML code assemantic as possible.


Semantic HTML

Semantic HTML means using correct HTML elements for their correct purpose as much as possible. Semantic elements are elements with a meaning; if you need a button, use the<button> element (and not a<div> element).

Semantic

<button>Report an Error</button>
Try it Yourself »

Non-semantic

<div>Report an Error</div>
Try it Yourself »

Semantic HTML gives context to screen readers, which read the contents of a page out loud.

With the button example in mind:

  • buttons have more suitable styling by default
  • a screen reader identifies it as a button
  • focusable
  • clickable

A button is also accessible for people relying on keyboard-only navigation; it can be clickable with both mouse and keys, and it can be tabbed between (using the tab key on the keyboard).

Examples ofnon-semantic elements:<div> and<span> - Tells nothing about its content.

Examples ofsemantic elements:<form>,<table>, and<article> - Clearly defines its content.


Headings Are Important

Headings are defined with the<h1> to<h6> tags:

Example

<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Try it Yourself »

Search engines use the headings to index the structure and content of your web pages.

Users skim your pages by its headings. It is important to use headings to show the document structure and the relationships between different sections.

Screen readers also use headings as a navigational tool. The different types of heading specify the outline of the page.<h1> headings should be used for main headings, followed by<h2> headings, then the less important<h3>, and so on.

Note: Use HTML headings for headings only. Don't use headings to make textBIG orbold.



Alternative Text

Thealt attribute provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in thesrc attribute, or if the user uses a screen reader).

The value of thealt attribute should describe the image:

Example

<img src="img_chania.jpg" alt="A narrow city street with flowers in Chania">
Try it Yourself »

If a browser cannot find an image, it will display the value of thealt attribute:

Example

<img src="wrongname.gif" alt="A narrow city street with flowers in Chania">
Try it Yourself »

Declare the Language

You should always include thelang attribute inside the<html> tag, to declare the language of the Web page. This is meant to assist search engines and browsers.

The following example specifies English as the language:

<!DOCTYPE html>
<html lang="en">
<body>

...

</body>
</html>

Use Clear Language

Always use a clear language, that is easy to understand. Also try to avoid characters that cannot be read clearly by a screen reader. For example:

  • Keep sentences as short as possible
  • Avoid dashes. Instead of writing 1-3, write 1 to 3
  • Avoid abbreviations. Instead of writing Feb, write February
  • Avoid slang words

Create Good Link Text

A link text should explain clearly what information the reader will get by clicking on that link.

Examples of good and bad links:

Note: This page is an introduction in web accessibility. Visit ourAccessibility Tutorial for more details.



×

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 ourterms of use,cookies andprivacy policy.

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


[8]ページ先頭

©2009-2025 Movatter.jp