what is HTML??

HTML stands for HyperText Markup Language. HTML is a language used by Web Developer/Designers/Programmers to describe the structure and content of a website, HTML is a Markup Language (language used to markup/define documents designed to be displayed in a web browser) and not a Programming language

HTML Documents are files that have extensions of .html or .htm, HTML Documents contains HTML elements/tags which are used by the browser to intrepret a page and to display it properly for the users. HTML elements/tags most commonly come in pairs like <h1> and </h1> but a few comes as self-closing tags or empty elements like: <img>

THE ANATOMY OF AN HTML ELEMENT

Elements are identified by tags in source code. Tags consist of the element name within angle brackets(<>) Any text that lies between this angle brackets are not displayed by the browser but used to interpret and structure the content.

Basic Document Structure

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>Title Here</title>
    </head>
    <body>
    CONTENTS GOES HERE
    </body>
    </html>
        

The First line in this example is called DOCTYPE DECLARATION OR DOCUMENT TYPE DECLARATION, It is used to communicate to browsers that the document is written in HTML5

The entire document is contained within an html element, which is also called the ROOT element cause it contains all elements in the document

The Document is then divided into two sections within the html element, the Head and Body. The head element contains all elements that pertain to the document and the web browser that are not displayed as content to the user. For example: Metadata, Script, Stylesheets, title .

The body element will contain everything that will be displayed to the users as content in the browser

Block and Inline Elements

They are basically two types of elements which are Block and Inline elements.

Block Element: They are elements that will begin on newline and takes up enough space on the document as though they were little rectangular boxes on the page. Examples are Headings, Paragraphs.
Inline Element: These are elements that flow within the flow of content. Examples are: img, span

Attributes

Attributes are instructions that clarify or modify an element. for instance the img element requires the attribute (src) to specify the locaton of the image
Attributes comes after the opening tags
<img src="" alt="">


HTML HEADINGS

Just like in English essay, we add some sort of heading to our essay to help our readers understand the structure of our essay. This headings or sub-headings help us in conveying the meaning or description of what the whole essay is about. There would mostly be a main heading which communicates the purpose of the essay and also some sub headings to give the meaning to other subsections of the essay.

In HTML, there are six levels of this heading ranging from h1 to h6, when we add heading to our contents, the browser use them to create a document outline for the page. Devices like screen readers use the document outline to help users to quickly scan and navigate through a page.

Each heading level has a default style of their own but they all mostly come out big and bold with h1 been the most important and h6 the least important we do not need to use a particular heading level just because we love the feel of the style but we should use them to help in a semantic way knowing that we can change the style with CSS

CODE:
<h1>THIS IS HEADING LEVEL 0NE</h1>
<h2>THIS IS HEADING LEVEL TWO</h2>
<h3>THIS IS HEADING LEVEL THREE</h3>
<h4>THIS IS HEADING LEVEL FOUR</h4>
<h5>THIS IS HEADING LEVEL FIVE</h5>
<h6>THIS IS HEADING LEVEL SIX</h6>
OUTPUT: An output showing different heading levels

HTML Paragraphs <p>...</p>

In English essay,we would defintely use Paragraphs in our write-ups and we also would start every new paragraph on newline so in HTML,we mark up paragraphs by placing contents in the opening tag (<p>) and the closing tag (</p>). Paragraphs are basically known as block element so they are displayed on newlines by default

Paragraphs can contain text, images and other inline elements but cannot contain heading and other element that are block elements by default


HTML LIST

HUMANS are natural list markers, we make lists for so many reasons for example:  A list of items we want to purchase at a grocery store, A list of to-dos, A list for making our favourite meals and some of this list requires a particular order (ORDERED LIST) while some do not require any order (UNORDERED LIST)
HTML provides elements for marking up three different types of lists :

  • Unordered lists
  • Ordered lists
  • Description Lists

Unordered Lists

Unordered lists are for lists that do not require an order, Unordered lists displays with a bullet before the list item and can be to change with style rules.
Unordered lists are marked up in ul elements.The opening tag <ul> goes before the first list item and closing tag </ul> goes after the last item, list items in Unordered list are marked up in opening <li> and closing </li>

Only list ltems are permitted within an Unordered list(i.e between <ul>...</ul>) however you can put any of type of content element within a list item

EXAMPLES SHOWING THE DEFAULT STYLE FOR UNORDERED LISTS:

    CODE:
<ul>
    <li>Toyota</li>
    <li>Mazda</li>
    <li>Ford</li>
    <li>Nissan</li>
</ul>
OUTPUT: ILLUSTRATON SHOWING DEFAULT STYLE FOR UNORDERED LIST

Ordered Lists

Ordered list are for items that are required to be in a sequential order such as procedure for cooking a meal,They function just like an unordered list but they are rather placed in the ol element and the browser orderly inserts numbers to an unordered list.
You can determine the values with which your ordered list numbering starts by using the start attribute in the ol element.

EXAMPLES SHOWING THE DEFAULT STYLE FOR ORDERED LISTS:

    CODE:
<ol>
    <li>Toyota</li>
    <li>Mazda</li>
    <li>Ford</li>
    <h4>Nissan</li>
</ol>
OUTPUT: ILLUSTRATON SHOWING DEFAULT STYLE FOR UNORDERED LIST

Description Lists

<dl>...</dl> --- Description List
<dt>...</dt> --- a name such as term or label
<dd>...</dd> --- a value such as description or definition

Description lists are used for any type of name/value pair such as terms and definitions, question and answers and so on. it's structure is quite different from ordered and unordered list. The whole description list is marked up inside dl element
The content of a dl is some numbers of dt element indicating the names and dd elements for their respective values.
The dl element is allowed to contain dt and dd element and you can't place heading/content-grouping element in dt element but dd element can contain other elements in it

EXAMPLES SHOWING THE DEFAULT STYLE FOR ORDERED LISTS:

    CODE:
<dl>
    <dt>Serif examples</dt>
    <dd>Baskervile</dd>
    <dd>Goudy</dd>
    <dt>Sans-serif examples</dt>
    <dd>Helvetica</dd>
    <dd>Futura</dd>
    <dd>Avenir</dd>
 </dl>
OUTPUT: ILLUSTRATON SHOWING DEFAULT STYLE FOR DESCRIPTION LIST


HTML images

Image Formats

We will get to the IMG element in a moment but it is of great important to note that you can't just put any image on a webpage, it must be in a one of the web-supported formats. Images that are made of grid of colored pixels(known as bitmapped or raster images) must be saved as an PNG, JPG or GIF file formats to be able to place on the web and while vector images would have an svg file format.
If you have images in other formats such as TIFF, BMP, you will have to convert it into web-supported format for you to able to add it into the web

THE IMG ELEMENT

<img>- Adds an inline image.
The img element helps to communicate to the browser to make a request for the image from the server and to display the image in flow with other content page.
The src and alt attributes are required in the img element ,The src (source) attribute provides the URL to locate the image file.
The alt attribute provides an alternative text that would be displayed if the image is not avaliable and it is helpful for accessiblity,if you add image that no important meaning to your page, it is important to leave the the alt attribute null.
for each image on your page ,consider what the alternative text would sound like,when the alternative text is read on assitive devices and how it would affects the experience of people using assitive technologies. BASIC FORMAT FOR INSERTING AN IMAGE:
<img src="" alt="">
It is important to note the following about img element:

  • It is an empty element,which means it doesn't have any content. you jnust place it in the flow of text where the image should go.
  • It is an inline element.
  • The img element is also known as a REPLACED element because it is replaced by an exeternal file when the page is displayed.
  • By default, the bottom edge of an image aligns with the baseline of text.

PROVISION OF DIMENSION FOR HEIGHT AND WIDTH

To indicate the dimension of an image,Use the WIDTH and HEIGHT attributes, Browsers uses the width and height to reserve a portion of space for the image in the layout to provides disruption of the page when the image fully load.
Make sure that the pixel dimensions you specify are the actual dimension of the image to prevent distorted image.

HTML Table

The use of a Table

HTML Tables were designed for instances where you need to add tabular content (data arranged in columns and rows) to your page and not for presentational purposes as it were used back in the early days of the web, It was used then to achieve multicolumn layout but with the power of stylesheet, we can use CSS to achieve multicolumn layout which helps in seperating markup from presentation hence improving accessiblity.

Table ELEMENT <table>...</table>

The HTML Table element is used to communicate to the browser that you are about to define a table, The Table element would contain the tr element and table cell elements(th an td elements).

Table row element <tr>...</tr>

The Table row element is used to define the number of rows that would be contained in the table and it contains the table cells (td and th elements), if you need a table with two rows, you would have to define two tr element in the table.

Table Cell

Cells are the vital part of a table, because the actual content goes with them there is no Table column element because the number of columns are implied by the number of cells in a row, so if you need four rows, you specify four tr element but if you need four columns, you specify four td or th elements in a row.
All content in the table must go within either the th element or td element, they could contain any type of content like text, image and so on.

The table is a three rows and three columns to show a table and struture(Note:The table has styled through css for better view):

CODE:
<table>
<tr>
    <th>Name </th>
    <th>Occupation</th>
    <th>Organisation</th>
</tr>
<tr>
    <td>Bukola Opade</td> 
    <td>Full-stack Developer</td> 
    <td>Oracle Academy</td> 
</tr>
<tr>
<td>Emmanuel Onaeko</td> 
<td>Front End Developer</td> 
<td>Emmaz Technologies</td> 
</tr>
</table>
Output:
Name Occupation Organisation
Bukola Opade Full-stack Developer Oracle Academy
Emmanuel Onaeko Front End Developer Emmaz Technologies

Table Header <th>...</th>

The text marked up in the th elements is dispalyed differently from other cells in a table because they are very important in providing information about a row or column they precede.

Spanning Cells

One fundamental feature of table struture is cell spanning, which is the streching of a cell to cover several rows or columns. spanning of cells create complex table strutures and it does has side effects of making it diffcult for users of screen readers.

Columns Spans

Colums spans is created with the colspan attribute in the td or th elements, it makes a cell to strecth to the right spanning over subsequent columns, the value of the colspan is number of the columns, the cells strecth to and if you do specify a number exceeding the number of column in the table, it adds exeternal column to the table.

The table shows an example of column spans:
CODE:
<table>
    <tr>
    <th colspan="2">FAT </th>
    </tr>
    <tr>
    <td>Occupation</td>
    <td>Organisation</td>
    </tr>
    </table>
OUTPUT:
ILLUSTRATON SHOWING COLUMN SPAN

Rowspans

Rowspans is created with the rowspan attribute in th or td elements, it makes a cel to strecth downwards over several rows.

The table shows an example of column spans:
CODE:
<table>
    <tr>
    <th rowspan="3">FRUIT </th>
    </tr>
    <tr>
    <td>Apples</td>
    </tr>
    <tr>
    <td>Pineapple</td>
    </tr>
    <tr>
    <td>Bananass</td>
    </tr>
</table>
OUTPUT:
ILLUSTRATON SHOWING ROW SPAN

HTML Multimedia

How media formats work

When a video or audio content is designed for the web, there are two format decisions to make, The First is how the media is encoded(algorithms used to convert the source to 1's and 0's and how they are compressed),The method used for encoding is called the CODEC short for code/decode
The second , You need to choose the container format for the media.

The Video Formats

  • MPEG-4 CONTAINER + H.264 video codec + AAC audio codec
  • WEBM container + VP8 video codec + vorbis audio codec
  • WEBM container + VP9 video codec + opus audio codec
  • ogg container + Theora video codec + vorbis audio codec

The Audio Formats

  • MP3
  • WAV
  • ogg container + vorbis audio codec
  • MPEG-4 container + AAC audio codec
  • WEBM container + vorbis audio codec
  • WEBM container + opus audio codec
Video support in desktop and mobile browsers (as of 2017)
Format Type IE MS Edge Chrome Firefox Safari Opera Android IOS Safari
MP4(H.264) Video/mp4 mp4 m4v 9.0+ 12+ 4+ YES* 3.2+ 25+ 4.4+ 3.2+
Webm(VP8) Video/webm webm webmv - - 6+ 4.0+ - 15+ 2.3+ -
Webm(VP9) Video/webm webm webmv - 14+ 29+ 28+ - 16+ 4.4+ -
Ogg Theora Video/ogg ogv - - 3.0+ 3.5+ - 13+ 2.3+ -

Audio support in current browsers (as of 2017)
Format Type IE MS Edge Chrome Firefox Opera Safari IOS Safari Android
MP3 audio/mpeg mp3 9.0+ 12+ 3.0+ 22+ 15+ 4+ 4.1 2.3+
WAV audio/wav or audio/wave - 12+ 8.6+ 3.5+ 11.5+ 4+ 3.2+ 2.3+
Ogg vorbis audio/mp4 m4a - - 4.0+ 3.5+ 11.5+ - - 2.3+
MPEG-4/AAC audio/ogg ogg oga 11.0+ 12+ 12.0+ - 15+ 4+ 4.1+ 3.0+
Webm/vorbis audio/webm webm - - 6.0+ 4.0+ 11.5+ - - 2.33+
Webm/opus audio/webm webm - 14+ 33+ 15+ 20+ - - -

HTML video Element <video>...</video>

The Video element is used to add a video player to the webpage, video on the web has to be in a particular format, but not all browsers supports all formats and so you might need to specify different formats and leave it up to the browser to determine the best format it should use. but if we ignore format differences, we could use one video just like in the image element using src attribute in the video tags.

An example of video element struture:
<video src="light_reel.mp4" width="640" 
height="480"
poster="light_reel.jpg" controls 
autoplay>...</video>
 

Attributes in the example to take note

  • width="pixel measurement" height="pixel measurement"
    They are used to specify the size of the box that contains the video player

  • Poster="url of image"
    Provides the location of an image to show up in place of the video before the video is played.

  • src="url of video"
    It provides the location of the video

  • Controls
    The controls attribute makes the browser to display its built in media controls (play/pause button,volume controls)

  • Autoplay
    It makes the video to start playing automatically after it has downloaded enough of the media file to play without stopping

  • Loop
    It makes the video to continously plaing muted. To make the video to be muted when it loads

Because it is much adviseable to specify different format and allow the browser to choose to avoid misfunctionality of the page, we could make use of the different source tag in the video element,
This example provides a video clip in the souped-up WebM/VP9 for,at for supporting browsers,as well as an MP4 and ogg Theora for other browsers:

CODE:
<video controls poster="clip.jpg">
<source src="clip.webm" type="video/webm"
<source src="clip.ogg" type="video/ogg"
<source src="clip.mp4" type="video/mp4"
</video>

The type attribute is used to give more information about the type of formats used for better and appropriate rendering

HTML Audio Element <audio>...</audio>

The Audio element functions more like the video element but exception to the following attributes:width, height,poster.
Just like in the video element, you can also provide different audio format options using the source element.

This example provides a video clip in the souped-up WebM/VP9 for,at for supporting browsers,as well as an MP4 and ogg Theora for other browsers:
CODE:
<audio controls>
<source src="song.webm" type="audio/webm"
<source src="song.ogg" type="audio/ogg"
<source src="song.mp4" type="audio/mp4"
</audio>

Adding Text Tracks

<track>...<track>- Adds Synchronized text to embedded media.

When using audio or video, it is adviseable to adds a synchronized text with the timeline of the video or audio.

Uses of Text Tracks

  • Subtitles in alternative language
  • Captions for the hearing impaired
  • Descriptions of which is happening in a video for sight impaired
  • Chapter titles to allow for navigation through the media
  • Metadata that is not displayed but can be used by scripts

Using Text tracks defintely makes media more accessible, use the track element in the video or audio element you want to annotate and the track element must appear after all the source elements and include these attributes.

  • src - to points to the text file.

  • kind - to specifies the type of text annotation you are providing, if kind is set to subtitle, you must also specify the language with the srclangattribute.

  • label - to provide a name for the track that can be used in the interface for selecting a particular track.

  • default - marks a particular track as default and it may be used on only one trackk within a media element.

This example provides English and French subtitle option to a video:
CODE:
<video width="640px" height="320" controls>
<source src="indigenous_movie,mp4" 
type="video/mp4">
<track src="english_subtitles.vtt"
kind="subtitles"
srclang="en"
label="English Subtitles"
default>
<track src="french_subtitles.vtt"
kind="subtitles"
srclang="fr"
label="sous-titres en francais">  

Web Video Text Tracks -- WebVTT

In the previous example, you notice that the track is point to a file with .vtt suffix, The text is in the WebVTT format.
A WebVTT Files contains cues to the video and look like this:
00:00:01.345 --> 00:00:03.456
Welcome to class
Cues are seperated with empty line spaces, Each cue has a start and end time seperated by an arrow.

Html sematic tags

When we write HTML, we must ensure that our markup is not only syntaxically correct but also semantically correct so that our content on our webpage can be accessible to all users of the web.
Semantic Tags helps in labelling content to show it's precise functions on the page and they also helps to divide the page in a more useful way For example we could use semantic tag to divide a page into header, main, footer , we about to dive into some semantic tags that help to build a more richer and accessible website.

Headers <header>...<header>

The header element is used to define the introductionary part of a page or section, The header element is not necessary used to only define the introductionary part of a webpage omly but can be used to define the introductionary part for articles, sections.

Footer <footer>...</footer>

The Footer element is used to define the type of information or content that would come at the end of a page For example Copyright informations, Trademarks, contact-me form, they do not necessary come at the end of the page only but can be used in associated with a particular section/article.

Main content <main>...</main>

The main element is used to specify the main part of the webpage of a particular section, The main element must be unique to the page or section and The W3C HTML specification states that pages should have one main section and it should not be nested with an article, aside, header, nav.

Section and Articles

<section>...</section> - Thematic group of content
<article></article>- Self-contained, reusable compostion.

Long document are eaiser to use if they are divided into smaller parts For example, Books are divided into chapters. To divide long web documents in thematic sections use the section element
Section element might contain an heading and other content that has a meaningful reason being grouped together.
Use article elements for self-contained works that could stand alone, it is much useful for newpaper articles, blogposts, comments.

Navigation <nav>... </nav>

We can group links that allows for easy access to the content to our users
When a combination of links acts as the primary navigation of our page, it is appropriate to wrap then up in a nav element to makes the purpose of the purpose of the links explivity clear as a navigation.