3D Gallery with Great Artwork Imagine Logo with Three Colors Beach Cabin 3D Android Tablet with Different Screens Studio Apartment Red Figured Greek Vase on Blue Background Silver and Gold Flashlight Lake on Fire

HTML Elements

Page 2

Semantic Elements

Introduction Sematic Element List Element Examples Description Lists Address, Article, Aside Figure, FigCaption iFrame Dialog CSS Summary

Introduction

Semantic elements describe the meaning of HTML tags. For Web developers meaning optimizes Web pages for search engines, or Web crawlers, and Web browsers. Also the developer can respond to semantic elements, based on their meaning, which helps organize and describe Web content.

Non semantic elements simply separate sections in a Web page, following either default rules defined for the tags, or customized styles. Many Web developers consider div and span, as non sematic elements.

This page lists many of the semantic elements, with their meanings. Learn how to apply a set of HTML semantic tags including mark, ins, i, del, sup, abbr, sub, address, article, aside, description lists, figures, figure captions and iframe. Most markup sections include the markup with the result of the markup. Viewing the HTML markup, and and the results, helps you understand how it renders on your Web page. Perhaps iframe offers one of the more interesting tags, as it allows you to include content from another page.

Sematic Element List

The following list includes many, but not all, of the semantic elements, with their meanings. Click a link to see an example. Most examples include markup, styles and JavaScript.

nav
The element used to navigate a Website.
abbr
An element which displays the abbreviated form of a term. Usually include the full term in the title attribute's value.
mark
Highlights text. Often the default background color equals yellow.
address
A company or person's name, street location, phone number or email contact.
article
Distinct content about one topic.
aside
Content which indirectly relates to the content of an article.
a
An anchor which links to another page or a bookmark within the same page.
area
A portion of an image, either as a rectangle, circle or polygon, that's selectable.
audio
Tag for one or more sound files.
source
Links to an external audio or video file within the audio or video tag.
ins
Underlined text, indicates it was inserted into a sentence or paragraph.
sup
Text assigned the superscript location. Usually placed higher than the baseline with a smaller font size.
sub
Text assigned the subscript location. Usually placed lower than the baseline with a smaller font size.
bdi
Bdirectional isolation. Text that may display in a different direction from the surrounding text.
bdo
Bdirectional Override. Use bdo with the dir attribute. Values declare the direction of text, such as rtl; meaning right to left.
blockquote
Quoted area that was taken from some other source. Used with the cite attribute. The cite's value describes the blockquote's source.
body
An HTML page's primary readable content area.
br
Line break.
button
A tappable or clickable area. Usually responds to JavaScript, PHP, Python or some other scripted language event handler.
canvas
A 2D or 3D area that can be highlighly interactive with color, text, images and other content, using scripted languages.
cite
Display a work's title.
code
Display computer code. Like pre, yet code's more likely to display less than one line. Like var, yet var often applies to math statements.
colgroup
Assign multiple columns in a table, with attributes.
col
Assign this tag within the colgroup element, to specify attributes and values for table columns.
data
Both machine legible value in the value attribute and human legible values between the opening and closing data tags.
datalist
A set of options, like a drop down list, that may be included in a form.
del
Crossed out text that indicates deletion.
details
Displays additional information about a topic.
summary
Heading for the details tag. Place within the details tag.
dfn
definition element. Provide the dfn value within the dfn opening and closing tags, followed by the definition within the parent element.
div
Developers may not consider div as a semantic element. However perhaps the tag could be interpreted as a division.
dl
A description list.
dt
Data term, contained within a dl element.
dd
Data definition, contained within a dl tag and following a dt element.
em
Developers may not consider em as a semantic element. However perhaps the tag could be consider semantic in that it represents emphasized text.
dialog
Creates a modal, or popup, box. This element isn't supported on all browsers, therefore validation may result in a warning.
embed
Add an external file to an HTML document within the embed tag.
fieldset
Organizes a set of fields in a form.
figure
Illustration, graphic or video.
figcaption
Caption for a figure. Inside the figure element.
table
Declares a table.
theader
Organize header content within a table tag.
th
table header. The header row of a table. Headers contain td, or table data.
tr
table row. A row in a table.
td
table data. An individual cell in a table.
caption
Tag to add a table title. The tag must be enclosed by the table.
footer
The end of a Web page usual includes contact information, the business, sitemap and other related content.
form
User input section.
h1 through h6 Tags
Headers from level one to level six. Each level represents a grouping by order of importance.
main
The primary content of a Web page.
html
Usually not considered a semantic element, yet it is interpreted to mean that a particular page is displayed with HTML
hr
Horizontal line or rule, that often crosses the page to separate concepts.
i
Italic (slanted text).
iframe
Display one Web page inside another Web page. Considered also an inline section or framed portion from another Web page.
section
Declare a section of a Web page.
video
Tag for video files. Enclose source tags within video tags to specify external video source files.
legend
The legend tag, declared within the form tag, provides a place for the form title.
head
Metadata container with information about the page's content, layout, styles and more. Place toward the page's top.
header
Start of an article
samp
Display text representing computer output.
meter
Display a guage, specifying an the amount within a range.
range
Display an interactive range, specifying an initial amount, which allows an interactive slider.
template
Prepare hidden content. Displays when activated with JavaScript.

More Elements

Look online for more semantic elements. This page lists many semantic elements, but not every tag.

Element Examples

Highlighted text: background colored, inserted text: underlined, alternate voice text: italic, deleted text: crossed out, superscript, ABBR, subscript. See the markup below, for these tags.

Markup for Tags

<mark>
 Highlighted text: 
 background colored
</mark>,

<ins>
 inserted text: 
 underlined
</ins>,

<i>
 alternate voice text: 
 italic
</i>,

<del>
 deleted text: 
 crossed out
</del>,

<sup>
 superscript
</sup>,

<abbr 
 title="Abbreviation">
 ABBR
</abbr>,

<sub>
 subscript
</sub>.

Description Lists

UWP
Universal Windows Program
WPF
Windows Presentation Foundation
OpenGL
Open Graphics Library

Description List Markup

It might be easier to remember description list elements with the following thoughts. Think of dl as representing a Description List. Think of dt as representing a Description Term and dd as representing a Description Definition.

<dl>
<dt>UWP</dt>
 <dd>
 Universal Windows Program
 </dd>
 
<dt>WPF</dt>
 <dd>
 Windows Presentation Foundation
 </dd>
 
<dt>OpenGL</dt>
 <dd>
 Open Graphics Library
 </dd>
</dl>

Address, Article, Aside

The address tag indicates addresses and other contact information, such as email. The article tag indicates distinct, or separate, self contained content. The aside tag indicates content that's indirectly related to the main content.

The article tag requires a heading between h2 and h6, within the article section.

Address Tag

Email: Seven Thunder Software

Rochester, NY, USA

Article Tag: My Skills
I'm versatile and helpful to others. I understand digital tools from back end, middleware, front end, to graphics applications.
Aside Tag: Graphics Background
Article Tag: Web Programming

Cross platform development represents the most important aspect of Web programming. The dream to write once for all devices, has truly arrived, especially as 5G and cloud services continue to gain momentum.

5G devices quickly, connect, download and respond to Web content. With cloud services, Web servers deliver astounding complex capabilities.

Markup: Address, Article & Aside

<h4>Address Tag</h4>

<address>

<a 
 href="mailto:Support@7Thunders.biz?subject=Seven%20Thunder%20Software" 
 title="Send Email to Seven Thunder Software">
 Email: Seven Thunder Software
</a>

<p>Rochester, NY, USA</p>

</address>

<div  style="font-family:Courier">

<article>

<h5>Article Tag: My Skills</h5>

I'm versatile and helpful to others. 
I understand digital tools 
from back end, middleware, 
front end, to graphics applications.
</article>

<h5> Aside Tag: Graphics Background</h5>

<aside style="color:blue;">
Digital imaging 
peaked my interest in programming.
I worked on 
<q>Attack of the Killer Tomatoes</q>,
<q>The Magic Paintbrush</q> 
and a few other graphics contracts,
before studying software development.
</aside>

<article>

<h5>Article Tag: Web Programming</h5>

<p>
Cross platform development represents 
the most important 
aspect of Web programming. 
The dream to <q>write once</q> 
for all devices,
has truly arrived, 
especially as 5G and cloud services 
continue to gain momentum.
</p>

<p>
5G devices quickly, connect, 
download and respond to Web content.
With cloud services, Web servers deliver 
astounding complex capabilities.
</p>

</article>

</div>

Figure, FigCaption

The figure with enclosed figcaption tags, allow Web developers to include a caption with an image.

Running Horse Sprite Sheet
Running Horse Sprite Sheet

Figure, FigCaption Markup

<figure>
 class="ex" 
 
<img 
 class="w100" 
 src="sprite-horse.png" 
 alt="Running Horse Sprite Sheet"
>

<figcaption
 class="w100"
>
 Running Horse Sprite Sheet
</figcaption>

</figure>

iFrame

Use an iframe to include the source from another page, in the current page. It's good practice to include a title in your iframe. The iframe also includes many attributes. The default width is 300 pixels wide and 150 pixels high.

The following iframe loads a page from this domain. However you can load content from other domains. Yet at times, other Web developers will move the content and, an error page will display. For some devices use the scroll bar on the right to view the top and bottom of the page. Except some iPhones display the entire height of the page contained in the iframe. For iPhones, and other similar phones, swipe left, right, up or down, to scroll.

iFrame Markup

Notice that the page loads with a bookmark, #water, to display the water image.

<iframe
 src="../rga.php#water" 
 title="HTML5 Visual Effects"
>
</iframe>

Dialog

The dialog tag displays a popup, modal dialog or subwindow. That means the dialog will cover elements on the page that are underneath it, on the Z axis.

The dialog element's not implemented in all browsers. Yet some browsers will enable HTML markup, with open or close properties, but not with JavaScript show() or hide() methods. This page modifies the style's opacity value to hide or show the dialog.

Simple Dialog

A simple dialog displays while overlapping or covering other elements, on the Web page. Tap on the dialog below, to close it. See the markup and JavaScript below, to learn how to display, then hide, the dialog with one click.

Click Dialog to Close

Simple Dialog Markup

Notice the property open, in the markup below, isn't declared as an attribute-value pair. You can also markup the dialog with close. With the close property, you'll see nothing.

You can use HTML markup with open and close properties. However, as mentioned above, JavaScript's hide() and show() methods aren't implemented yet, in all browsers. To open and close a dialog programmatically, required modifying the style's opacity value, at this time. When the dialog tag receives full support on the Web, then the JavaScript show() and hide() methods should work fine.

<dialog 
 id="diag" 
 style="float:right; border:solid 1px blue" 
 onclick="closeDialog() 
 open
>
Click Dialog to Close
</dialog>

Simple Dialog JavaScript

/**
* Close modal dialog.
* Obtain the dialog's id.
* Assign the style opacity 
* a value of zero.
*/
function closeDialog(){
 var diag = document.getElementById('diag'); 
 diag.style.opacity = 0;
}

Dialog Opens & Closes

Click to close the following dialog. To open the dialog, prepare button markup with an onclick event listener which restores the dialog's opacity. If the button's markup is immediately below the dialog, then you might not see the button, because the dialog will cover the button. If you tap the dialog to close it, you might not be able to activate the button's onclick event handler.

Why is that? Since dialogs act like popup windows they cover elements on the Web page. I'm using opactity = 0 , to hide the dialog. Therefore the dialog still exists and still covers the button. You can see the button, but it's under the invisible dialog. Therefore when you click on the button, the invisible dialog's event handler activates instead of the button's event handler.

Usually the dialog would cover the button based on the browser's size and orientation. On most desktops you could float the button left and the dialog right, preventing overlap. However on most phones and other devices in portrait orientation, the dialog would still overlap the button.

As mentioned earlier, the dialog tag is not implemented in every browser. On my current FireFox Web browser, the JavaScript show() and hide() methods aren't implemented. In that case, you can assign the opacity style value as 1 to display and 0 to hide, a dialog.

There are a number of tricks you can try to activate the button's onclick event handler, such as removing the dialog's event handler and changing it's z value. For this example, I just used a header with some padding to always keep the button below the dialog box.

In the following event handler you see a dialog box with a solid blue border, that says Click to Close Dialog. Under the dialog box is a button that says Click to Open Dialog.

Click to Close Dialog

Open Dialog Button:

Markup: Dialog Opens & Closes

The following markup was applied to the dialog box that closes and button that opens, the dialog box.

<dialog 
 id="dia" 
 style="border:solid 1px blue;"  
 onclick="dialogClose()" 
 open
>

 Click to Close Dialog

</dialog>

<!!-- Add padding to prevent overlap -->
<h4 
 style="padding-top:8%;">
 Open Dialog Button:
</h4>

<button 
 id="bt" 
 onclick="dialogOpen()">
 Click to Open Dialog
</button>

JavaScript: Dialog Opens & Closes

The following JavaScript was applied to the dialog box that closes and button that opens, the dialog box.

var d = null;

/**
* Obtain the dialog
* box by ID.
* Assign opacity of zero,
* which makes the dialog invisible.
*/
function dialogClose(){

 d = document.getElementById('dia');
 
 if(d != null) {
  d.style.opacity = 0;
 }
}

/**
* Assign opacity of one,
* to the dialog, which
* makes the dialog visible.
*/
function dialogOpen(){
 if(d != null){
  d.style.opacity = 1;
 }
}

Template

Templates, like many other HTML elements allow developers to hide and show their content. However, with this example, the template's not added to the body until the user clicks the Show Template button.

In this case scroll to the location of the new template. The template displays at the bottom of the page, because this particular JavaScript just appends the page. Additionally despite the fact that the template has an ID. You must create a new ID at the bottom of the page, to find the template.

Hue, Saturation, Lightness

Template Markup

<template>

<h2 
class="ct">
HSL
</h2>

<img 
class="wct" 
src="../../thumbnails/ss-hsl.png" 
width="256" 
height="256"
>

</template>

Template Styles

These styles center the text and image on the page.

.ct{
text-align:center;
}

.wct{
float:none; 
display:block; 
clear:both;
text-align:center; 
margin:0px auto 0px auto;
}

Template JavaScript

On this page there's only one template. Therefore you can access template[0] of the document. Additionally I added an element, at the bottom of the page with an id of temp. That enables code to scroll down to the new template.

function showTemplate() {
var temp = document.getElementsByTagName("template")[0];
var clon = temp.content.cloneNode(true);
document.body.appendChild(clon);
window.location ="#temp";
}

CSS

The following internal styles were applied to elements on this page.

dt,abbr{
 font-weight:bold; 
}

.ex,.w100{
 width:60%;
 display:block; 
 margin-left:auto; 
 margin-right:auto; 
 text-align:center;
}

iframe{ 
 display:block; 
 overflow:scroll; 
 margin-left:auto; 
 margin-right:auto; 
 text-align:center;
}

.w100{width:100%;}

#bt{
 display:block; 
 text-align:center;width:50%; 
 margin-left:auto; 
 margin-right:auto;  
}

dialog{
 text-align:center;
}

@media (orientation: portrait) {
 .ex{
  width:100%;
 }
}

Summary

Semantic elements describe the meaning of HTML tags; for the developer, search engines, or Web crawlers, and Web browsers. The developer, search engines and Web browsers can respond to semantic elements, based on their meaning, which helps organize and describe Web content.

Non semantic elements simply separate sections in a Web page, following either default rules defined for the tags, or customized styles. Many Web developers consider div and span, as non sematic elements.

This page listed most of the semantic elements, with their meanings. We also saw how to apply a set of HTML semantic tags including mark, ins, i, del, sup, abbr, sub, address, article, aside, description lists, figures, figure captions and iframe. Most markup sections included the markup with the result of the markup; what the markup renders to your Web page. Perhaps iframe offers one of the more interesting tags, as it allows you to include content from another page.

Unusual HTML5 Skills

See the markup, CSS and results of various HTML5 elements, with styles and some unusual or seldom used techniques.

Tags
Hire a Web developer. Website developer, Web programmer, hire a Web programmer, HTML markup, Web coding. learn online, free code,

Ads >
Create 3D Games: Learn WebGL Book 2 Simple Shaders: Learn WebGL Book 4
3D Programming for Beginners: Learn WebGL Book 1

for Web graphics!

Copyright © 2022 Amy Butler. All Rights Reserved.