Html5 Semantic Tags Cheat Sheet

Posted on  by 



By Rob Gravelle

Head tags – Make sure you don't miss anything important from the head section of the website. Open graph – Complete the head section with the Open Graph protocol to help social media sites understand the page. HTML5 page structure – A demo page built using the HTML5 elements. HTML Cheat Sheet PDF.

  1. Semantic HTML is the use of named HTML markup to mark the semantics, or meaning of content on a webpage or a web application. There are a lot of HTML5 semantic elements note / cheat sheet that you can find online.
  2. HTML URL; HTML Cheat Sheet; HTML Tag Abbreviation. HTML 5 Semantic Elements; HTML 5 Web Storage. HTML 5 WebSocket; HTML C heat Sheet.
  3. For (let key, value of Object.entries(object1)) returns array of object's keys and values: key, value MDN.

The W3C HTML5 specification introduces numerous new tags to define semantic/structural elements, text-formatting instructions, form controls, input types, and more. This page describes all of the new HTML5 tags along with updates to an existing tag.

New Semantic/Structural Elements

HTML5 offers new semantic elements to define different parts of a web page:

<article>

A self-contained composition in a document that is independently distributable or reusable, e.g. a forum post, a magazine or newspaper article, or blog entry.

<aside>

Defines content tangentially related to the content surrounding it, such as related reading links and glossaries, which may or not be nested within an article element.

<figcaption>

Defines a caption for a <figure> element

<figure>

Reference

Used in conjunction with the <figcaption> element to mark up diagrams, illustrations, photos, and code listings, etc.

<header>

Not be confused with the <head> element, the <header> tag typically contains the section?s heading (an h1?h6 element), as well as other content, such as a navigation links, table of contents, a search form, or any relevant logos.

<footer>

For content located at the very bottom of the web page or nearest section. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, etc. It in turn may contain entire sections, with appendices, indexes, license agreements, and other similar content.

<main>

Delineates the main content of the body of a document or web app. As such, the main content area holds content that is directly related to or expands upon the central topic of the page. Moreover, it helps screen readers and other assistive technologies understand where the main page content begins.

<mark>

Meant to bring the reader?s attention to a part of the text due to its contextual relevance.

<nav>

Denotes a section with navigation links, either to other pages or to parts within the same page.

<section>

Unlike the <div> tag, which is used for a myriad of purposes, not the least of which is formatting content, the <section> element demarcates a thematic grouping of content. Each section typically includes a heading element and associated content within DIVs and Paragraphs. Examples include introduction, blog entries, and contact information.

<details>

Produces an expandable box to display additional information. The expanding/collapsing behaviour does not depend on scripting, so it should work even if JavaScript is disabled or not supported.

<summary>

An optional element that summarizes the contents of the parent details element. As such, it may contain a description, caption, or legend.

<time>

Contains both human-friendly contents, along with a machine-readable form of those contents in the datetime attribute. The kinds of content range from various kinds of dates, to times, time-zone offsets, and durations.

Text-level Elements

<bdi>

Defines a part of text that might be formatted in a different direction from other text

<wbr>

Defines a possible line-break in text that is written as one long word.

New Form Elements

HTML5 introduces a number of new input types, attributes, and other elements to the HTML language.

<datalist>

Defines pre-defined options for input controls. It works in a similar way to an autocomplete textbox.

<keygen>

Defines a key-pair generator field (for forms). When the control's form is submitted, the private key is stored in the local keystore, and the public key is packaged and sent to the server.

<output>

Defines the result of a calculation

<progress>

Presents a progress bar that tracks the progress of a task.

New Input Types

Html5 Cheat Sheet Pdf

Cheat

HTML5 introduced a number of new input types for forms to address specific behavioral and formatting requirements that were lacking for the HTML 4.01 spec. For instance, handling the inputting of dates, numbers, telephone numbers, etc.

New Input TypesNew Input Attributes
  • color
  • date
  • datetime
  • datetime-local
  • email
  • month
  • number
  • range
  • search
  • tel
  • time
  • url
  • week
  • autocomplete
  • autofocus
  • form
  • formaction
  • formenctype
  • formmethod
  • formnovalidate
  • formtarget
  • height and width
  • list
  • min and max
  • multiple
  • pattern (regexp)
  • placeholder
  • required
  • step

More Relaxed Attribute Syntax

In HTML5, attribute values may be delimited by single or double quotes or, in the case of single word entries, without either. Attributes without a value (such as disabled) don't require an equals or quotes (=').

Graphic Elements

Defines graphic drawing using JavaScript Defines graphic drawing using SVG

See the following article for more information on the HTML5 canvas element and this article for more on the HTML5 svg element.

Media Elements

As the Internet becomes a more immersive multi-media experience, browsers are now equipped to handle many media types without the need for additional plugins. A prime example is the <embed> element that has to an explosion in YouTube video sharing.

<audio>

Defines sound or music content

<embed>

Defines containers for external applications (usually a video player)

<source>

Defines sources for <video> and <audio>

<track>

Defines tracks for <video> and <audio>

<video>

Defines video or movie content

The HTML5 <!DOCTYPE> Declaration

The <!DOCTYPE> declaration is not an HTML tag per se, but rather an instruction to the web browser about what version of HTML the page is written in. In HTML 4.01, the <!DOCTYPE> declaration referred to a DTD, because HTML 4.01 was based on SGML. Since HTML5 is no longer based on SGML, Web documents do not require a reference to a DTD. The <!DOCTYPE> declaration must be on the very first line of your HTML document, before the opening <HTML> tag.

The following table compares some previous HTML 4.01 <!DOCTYPE> declarations to HTML5's single replacement:

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<!DOCTYPE HTML>

This look-up system only works with Javascript activated. You can do a manual look up in the complete list of keywords (TBD).

Lookup in HTML, JavaScript, CSS, SVG, XPath:

Accessibility: WCAG2 at a Glance

Perceivable

  • Provide text alternatives for non-text content.
  • Provide captions and alternatives for audio and video content.
  • Make content adaptable; and make it available to assistive technologies.
  • Use sufficient contrast to make things easy to see and hear.

Operable Winzix exe download.

  • Make all functionality keyboard accessible.
  • Give users enough time to read and use content.
  • Do not use content that causes seizures.
  • Help users navigate and find content.

Understandable

  • Make text readable and understandable.
  • Make content appear and operate in predictable ways.
  • Help users avoid and correct mistakes.

Robust

  • Maximize compatibility with current and future technologies.

See WCAG Overview.

Internationalization Quicktips

Use Unicode wherever possible for content, databases, etc. Always declare the encoding of content.

The character encoding you choose determines how bytes are mapped to characters in your text.

Normally character encodings limit you to a particular script or set of languages. Unicode allows you to deal simply with almost all scripts and languages in use around the world. In this way Unicode simplifies the handling of content in multiple languages, whether within a single page or across one or more sites. Unicode is particularly useful when used in forms, scripts and databases, where you often need to support multiple languages. Unicode also makes it very straightforward to add new languages to your content.

Unless you appropriately declare which character encoding you are using your users may be unable to read your content. This is because incorrect assumptions may be made by the application interpreting your text about how the bytes map to characters.

Give me more background
Character encodings for beginners explains some of the basic concepts about character encodings, and why you should care. Introducing Character sets and Encodings gives an gentle introduction to various aspects of the topic.
So, how do I do this?
HTML & CSS authors • Spec developers• Server setup

Use characters rather than escapes (e.g. &#xE1; &#225; or &aacute;) whenever you can.

Escapes such as Numeric Character References (NCRs), and entities are ways of representing any Unicode character in markup using only ASCII characters. For example, you can represent the character á in X/HTML as &#xE1; or &#225; or &aacute;.

Such escapes are useful for clearly representing ambiguous or invisible characters, and to prevent problems with syntax characters such as ampersands and angle brackets. They may also be useful on occasion to represent characters not supported by your character encoding or unavailable from your keyboard. Otherwise you should always use characters rather than escapes.

Give me more background
Using character entities and NCRs provides additional information about the use of escapes in markup languages. In particular, note that entities (such as &aacute;) should be used with caution.
So, how do I do this?
HTML & CSS authors • Spec developers • SVG authors

Declare the language of documents and indicate internal language changes.

Information about the (human) language of content is already important for accessibility, styling, searching, editing, and other reasons. As more and more content is tagged and tagged correctly, applications that can detect language information will become more and more useful and pervasive.

When declaring language, you may need to express information about a specific range of content in a different way from metadata about the document as a whole. It is important to understand this distinction.

Give me more background
Language on the Web gives an gentle introduction to various aspects of the topic.
So, how do I do this?
HTML & CSS authors • SVG authors • XML authors • Schema developers • Server setup

Use style sheets for presentational information. Restrict markup to semantics.

It is an important principle of Web design to keep the way content is styled or presented separate from the actual text itself. This makes it simple to apply alternative styling for the same text, for example in order to display the same content on both a conventional browser and a small hand-held device.

This principle is particularly useful for localization, since different scripts have different typographic needs. For example, due to the complexity of Japanese characters, it may be preferable to show emphasis in Japanese X/HTML pages in other ways than bolding or italicisation. It is much easier to apply such changes if the presentation is described using CSS, and markup is much cleaner and more manageable if text is correctly and unambiguously labelled as 'emphasised' rather than just 'bold'.

It can save considerable time and effort during localization to work with CSS files rather than have to change the markup, because any needed changes can be made in a single location for all pages, and the translator can focus on the content rather than the presentation.

Give me more background
Read the talks slides from the 2007 @media conference presentation 'Designing for International Users: Practical Tips'.
Cheat

Check for translatability and inappropriate cultural bias in images, animations & examples.

If you want your content to really communicate with people, you need to speak their language, not only through the text, but also through local imagery, color, objects and preoccupations. It is easy to overlook the culture-specific nature of symbolism, behaviour, concepts, body language, humor, etc. You should get feedback on the suitability and relevance of your images, video-clips, and examples from in-country users.

You should also take care when incorporating text in graphics when content is translated. Text on complex backgrounds or in restricted spaces can cause considerable trouble for the translator. You should provide graphics to the localization group that have text on a separate layer, and you should bear in mind that text in languages such as English and Chinese will almost certainly expand in translation.

Give me more background
Read the talks slides from the 2007 @media conference presentation 'Designing for International Users: Practical Tips'.

Use an appropriate encoding on both form and server. Support local formats of names/addresses, times/dates, etc.

The encoding used for an HTML page that contains a form should support all the characters needed to enter data into that form. This is particularly important if users are likely to enter information in multiple languages.

Databases and scripts that receive data from forms on pages in multiple languages must also be able to support the characters for all those languages simultaneously.

The simplest way to enable this is to use Unicode for both pages containing forms and all back-end processing and storage. In such a scenario the user can fill in data in whatever language and script they need to.

Html5 Semantic Tags Cheat Sheet Printable

You should also try to avoid making assumptions that things such as the user's name and address will follow the same formatting rules as your own. Ask yourself how much detail you really need to break out into separate fields for things such as addresses. Bear in mind that in some cultures there are no street names, in others the house number follows the street name, some people need more than one line for the part of the address that precedes the town or city name, etc. In fact in some places an address runs top down from the general to the specific, which implies a very different layout strategy. Be very careful about building into validation routines incorrect assumptions about area codes or telephone number lengths. Recognize that careful labelling is required for how to enter numeric dates, since there are different conventions for ordering of day, month and year.

If you are gathering information from people in more than one country, it is important to develop a strategy for addressing the different formats people will expect to be able to use. Not only is this important for the design of the forms you create, but it also has an impact on how you will store such information in databases.

So, how do I do this?
HTML & CSS authors • HTML & CSS authors • Spec developers

Use simple, concise text. Use care when composing sentences from multiple strings.

Simple, concise text is easier to translate. It is also easier for people to read if the text they are reading is not in their first language.

You should take considerable care when composing messages from multiple substrings, or when inserting variable text into strings. For example, suppose your site uses JSP scripting, and you decide to compose certain messages on the fly. You may create messages by concatenating separate substrings, such as 'Only' or 'Don't', ' return results in ', and 'any format' or 'HTML'. Because the order of text in sentences of other languages can be very different, translating this may present major difficulties.

Similarly, it is important to avoid fixing the positions of variables in text such as 'Page 1 of 10'. The syntax of other languages may require the numbers to be reversed to make sense. If you use PHP, this would mean using a formatting string such as 'Page %1$d of %2$d.', rather than the more simple 'Page %d of %d.'. The latter is untranslatable in some languages.

So, how do I do this?
HTML & CSS authors

On each page include clearly visible navigation to localized pages or sites, using the target language.

Html5 Syntax Cheat Sheet

Where you have versions of a page or site in a different language, or for a different country or region, you should provide a way for the user to view the version they prefer. This should be available from any page on your site where an alternative exists.

When providing links to pages in other languages, use the name of the target language in the native language and script. Don't assume that the user can read English. For example, in a link to a French page, 'French' would be written 'français'. This also applies if you are guiding the user to a country- or region-specific page or site, eg. 'Germany' would be 'Deutschland'.

Html5 Semantic Tags Cheat Sheet
So, how do I do this?
HTML & CSS authors

For XHTML, add dir='rtl' to the html tag for right-to-left text. Only re-use it to change the base direction.

Text in languages such as Arabic, Hebrew, Persian and Urdu is read from right to left. This reading order typically leads to right-aligned text and mirror-imaging of things like page and table layout. You can set the default alignment and ordering of page content to right to left by simply including in the html tag.

The direction set in the html tag sets a base direction for the document which cascades down through all the elements on the page. It is not necessary to repeat the attribute on lower level elements unless you want to explicitly change the directional flow.

Embedded text in, for example, Latin script still runs left to right within the overall right to left flow. So do numbers. If you are working with right to left languages, you should become familiar with the basics of the Unicode bidirectional algorithm. This algorithm takes care of much of this bidirectional text without the need for intervention from the author. There are some circumstances, however, where markup or Unicode control characters are needed to ensure the correct effect.

Give me more background
Creating (X)HTML Pages in Arabic & Hebrew provides a gentle introduction to the basics of handling right-to-left text in HTML. The principles are similar for other markup languages.
What you need to know about the bidi algorithm and inline markup provides a gentle introduction to the basics of handling inline bidirectional text.
So, how do I do this?
HTML & CSS authors • SVG authors • XML authors • Schema developers

Validate! Use techniques, tutorials, and articles at http://www.w3.org/International/

English Typography

Use the proper English characters instead of their misused equivalents.

Quotes
(&#8220;) opening quote (instead of ')
(&#8221;) closing quote (instead of ')
Apostrophe
(&#8217;) apostrophe (instead of ')
Dashes and Hyphens
(&#8211; or &ndash;) en dash, used for ranges, e.g. “13–15 November” (instead of -)
(&#8212; or &mdash;) em dash, used for change of thought, e.g. “Star Wars is—as everyone knows—amazing.” (instead of -, or --)
Ellipsis
(&#8230; or &hellip;) horizontal ellipsis, used to indicate an omission or a pause (instead of ..)




Coments are closed