HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements...

55
HTML 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06. HTML Lines Lesson 07. HTML Tag Reference Lesson 08. HTML Formatting Tags Lesson 09. HTML Hyperlinks Lesson 10. HTML link syntax Lesson 11. Background color Lesson 12. Changing Font (Font name, Color & Size) Lesson 13. Text Alignment Lesson 14. HTML Images Lesson 15. HTML Forms Lesson 16. HTML forms The Input Element Lesson 17. HTML Password Field Lesson 18. HTML Radio Buttons Lesson 19. HTML Checkboxes Lesson 20. HTML Tables Lesson 21. HTML div Tag Lesson 22. HTML <span> Tag Lesson 23. HTML Layouts Lesson 24. HTML Layouts Using <div> Elements Lesson 25. HTML Layouts Using Table

Transcript of HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements...

Page 1: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 1

Content

Lesson 01. Introduction

Lesson 02. HTML Elements

Lesson 03. HTML BASIC

Lesson 04. HTML HEADING

Lesson 05. HTML Paragraphs

Lesson 06. HTML Lines

Lesson 07. HTML Tag Reference

Lesson 08. HTML Formatting Tags

Lesson 09. HTML Hyperlinks

Lesson 10. HTML link syntax

Lesson 11. Background color

Lesson 12. Changing Font (Font name, Color & Size)

Lesson 13. Text Alignment

Lesson 14. HTML Images

Lesson 15. HTML Forms

Lesson 16. HTML forms – The Input Element

Lesson 17. HTML Password Field

Lesson 18. HTML Radio Buttons

Lesson 19. HTML Checkboxes

Lesson 20. HTML Tables

Lesson 21. HTML div Tag

Lesson 22. HTML <span> Tag

Lesson 23. HTML Layouts

Lesson 24. HTML Layouts – Using <div> Elements

Lesson 25. HTML Layouts – Using Table

Page 2: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 2

Lesson 27. HTML Output - Useful Tips

Lesson 28. The HTML <meta> Element

Lesson 29. Lists

Lesson 30. HTML Entities

Lesson 31. HTML5 Video - How It Works

Lesson 32. HTML5 Audio

Lesson 33: HTML Color Code

Lesson 34. RGB (Red, Green, Blue)

Lesson 01: Introduction

What is HTML?

With HTML you can create your own Web site.

This tutorial teaches you everything about HTML.

HTML is easy to learn - You will enjoy it.

HTML is a language for describing web pages.

HTML stands for Hyper Text Markup Language

HTML is a markup language

A markup language is a set of markup tags

The tags describe document content

HTML documents contain HTML tags and plain text

HTML documents are also called web pages

Page 3: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 3

HTML Tags

HTML markup tags are usually called HTML tags

HTML tags are keywords (tag names) surrounded by angle brackets like

<html>

HTML tags normally come in pairs like <b> and </b>

The first tag in a pair is the start tag, the second tag is the end tag

The end tag is written like the start tag, with a forward slash before the tag

name

Start and end tags are also called opening tags and closing tags

<tagname>content</tagname>

Lesson 02. HTML Elements

"HTML tags" and "HTML elements" are often used to describe the same thing.

But strictly speaking, an HTML element is everything between the start tag and the

end tag, including the tags:

HTML Element:

<p>this is a paragraph. </p>

Web Browsers

The purpose of a web browser (such as Google Chrome, Internet Explorer, Firefox,

Safari) is to read HTML documents and display them as web pages.

Page 4: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 4

The browser does not display the HTML tags, but uses the tags to determine how

the content of the HTML page is to be presented/displayed to the user:

Page 5: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 5

The <!DOCTYPE> Declaration

The <!DOCTYPE> declaration helps the browser to display a web page correctly.

There are many different documents on the web, and a browser can only display an

HTML page 100% correctly if it knows the HTML type and version used.

Common Declarations

HTML5

<!DOCTYPE html>

Page 6: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 6

HTML 4.01

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

XHTML 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Lesson 03: HTML BASIC

Writing HTML Using Notepad or TextEdit

HTML can be edited by using a professional HTML editor like:

Adobe Dreamweaver

Microsoft Expression Web

CoffeeCup HTML Editor

However, for learning HTML we recommend a text editor like Notepad (PC) or

TextEdit (Mac). We believe using a simple text editor is a good way to learn

HTML.

Page 7: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 7

Follow the 4 steps below to create your first web page with Notepad.

Step 1: Start Notepad

To start Notepad go to:

Start

All Programs

Accessories

Notepad

Step 2: Edit Your HTML with Notepad

Type your HTML code into your Notepad:

Step 3: Save Your HTML

Select Save as.. in Notepad's file menu.

When you save an HTML file, you can use either the .htm or the .html file

extension. There is no difference, it is entirely up to you.

Save the file in a folder that is easy to remember, like Sahalsoftware.

Step 4: Run the HTML in Your Browser

Page 8: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 8

Start your web browser and open your html file from the File, Open menu, or just

browse the folder and double-click your HTML file.

The result should look much like this:

Lesson 04. HTML HEADING

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

Example:

<h1> This a heading </h1>

<h2> This a heading </h2>

<h3> This a heading </h3>

<h4> This a heading </h4>

<h5> This a heading </h5>

<h6> This a heading </h6>

Page 9: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 9

Lesson 05. HTML Paragraphs

<h1> This is a Heading </h>

<p> This is a first Pragraph </p>

<p> This is a second Pragraph </p>

<p> This is a third Pragraph </p>

Lesson 06. HTML Lines

The <hr> tag creates a horizontal line in an HTML page.

The <hr> tag can be used to separate content:

Try

<h1> This is a Heading </h>

<hr> <p> This is a first Pragraph </p>

<hr> <p> This is a second Pragraph </p>

<p> This is a third Pragraph </p>

Note: some HTML tag only they have start tag.

Page 10: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 10

Lesson 07. HTML Tag Reference

<! Doctype html> “declaration helps the browser to display a web page correctly.”

<html> “Defines an HTML document”

<body> “Defines the document’s body”

<h1> to <h6> “Defines HTML Heading”

<! -- > “Defines a comment”

<p> “Defines a paragraph”

<br> “Inserts a single line break”

Page 11: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 11

Lesson 08. HTML Formatting Tags

<b> “Defines bold text”

<em> “Defines emphasized text”

<i> “Defines italic text”

<small> “Defines smaller text”

<strong> “Defines important text”

<sub> “Defines subscripted text”

<sup> “Defines superscripted text”

<ins> “Defines inserted text”

<del> “Defines deleted text”

Page 12: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 12

Lesson 09. HTML Hyperlinks

The <a> tag defines a hyperlink.

A hyperlink (or link) is a word, group of words, or image that you can click on to

jump to another document.

When you move the cursor over a link in a web page, the arrow will turn into a

little hand.

The most important attribute of the <a> tag is the href attribute, which indicates

the link’s destination.

Page 13: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 13

Lesson 10. HTML link syntax

The HTML code for a link is simple. It looks like this:

<a href=”URL”> link text </a>

Try:

<!Doctype HTML>

<html>

<body>

<a href="http://www.sahalsoftware.com"> Halkan Riix si aad cilmi uga baratid

Sahalsoftware</a> <br>

<a href="http://www.sahalsoftware.com" target="_blank">Hoyga Aqoonta

Computerka!</a> <br> <br>

</body>

</html>

Page 14: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 14

Lesson 11. Background color

The background-color property defines the background color for an element:

Try:

<!DOCTYPE html>

<html>

<body style="background-color:yellow;">

<h1 style="background-color:green;">This is a Heading </h1>

</body>

</html>

Page 15: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 15

Lesson 12. Changing Font (Font name, Color & Size)

Try:

Try:

<!DOCTYPE>

<html>

<body >

<p style="font-family:arial; color:red; font-size:80px; "> Sheeko

Kooban </p>

<p> Sheeko Taxane ah </p>

</body>

</html>

Page 16: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 16

Lesson 13. Text Alignment

<!DOCTYPE>

<html>

<body >

<h1 style="text-align:left;"> This is a Heading </h1>

<h1 style="text-align:center;"> This is a Heading </h1>

<h1 style="text-align:right;"> This is a Heading </h1>

</body>

</html>

Lesson 14. HTML Images

HTML images are defined with the <img> tag.

<img src="Sahalsoftware.jpg" width="104" height="142">

Try:

<!Doctype html>

<html>

Page 17: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 17

<body>

<img src="E:\Prac\Web Design\HTML\Prac\MJ.jpg" width="104"

height="100" alt="Sawirkan waa MJ" Title="Daawo Sawirkan"

style="float: left; margin-right: 10px; margin-bottom: 5px;

border: solid black 1px; padding: 2px">

<p> Casharkan waxaa lagugu barayaa sidii aad sawir computerkaaga

yaala u soo gelin lahayd HTML –kaaga. Iyada oo lagugu barayo weliba

Attribute farabadan oo aan ka maarmin xiliga aad u baahan tahay in

webkaaga sawirka sidaad rabtid aad u soo gelin kartid </p>

<p style="clear: left"> Casharkan isku day inaad Attribute ka ku jiro

aad si fiican uga faa’iideysatid adiga oo marba dhinac ka

tijaabinaya.</p>

<p>Tusaale ahaan TAG –ga float wuxuu kaa caawinayaa dhinaca aad

Page 18: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 18

sawirka geynaysid, </p>

<p> margin ku wuxuu kaa caawinayaa sawirka iyo qoraalka inaad kala

yar goysid</p>

</body>

</html>

Note: The filename and the size of the image are provided as attributes.

Lesson 15. HTML Forms

HTML forms are used to pass data to a server.

An HTML form can contain input elements like text fields, checkboxes, radio-

buttons, submit buttons and more.

A form can also contain select lists, texarea, fieldset, and label elements.

The <form> tag is used to create an HTML form:

.

Input elements

.

</form>

Page 19: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 19

Lesson 16. HTML forms – The Input Element

The most important form element is the <input> element.

The <input> element is used to select user information.

An <input> element can vary in many ways, depending on the type attribute. An

<input> element can be of type text field, checkbox, password, radio button,

submit button, and more.

The most common input types are described below.

<html>

Page 20: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 20

<body>

<form action="div.html" method="get">

First name: <input type="text" name="firstname"> <br>

Last name: <input type="text" name="lastname"><br>

<input type="submit" value="Submit">

</form</body>

</html>

Lesson 17. HTML Password Field

<input type =”password”> defines a password field:

<form>

Password: <input type=”password” name=”pwd”>

</form>

Page 21: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 21

Lesson 18. HTML Radio Buttons

<input type=”radio”> defines a radio button. Radio buttons let a user select ONLY

ONE of a limited number of choices:

<form>

<input type="radio" name="sex" value="male">Male<br>

<input type="radio" name="sex" value="female">Female

</form>

Lesson 19. HTML Checkboxes

<input type=”checkbox”> defines a checkbox button. Checkbox let a user select

ZERO or MORE options of a limited number of choices.

<form>

<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>

<input type="checkbox" name="vehicle" value="Car">I have a car

</form>

Page 22: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 22

Lesson 20. HTML Tables

A table is divided into rows (with the <tr> tag), and each row is divided into data

cells (with the <td> tag). td stands for "table data," and holds the content of a data

cell. A <td> tag can contain text, links, images, lists, forms, other tables, etc. also

Header information in a table are defined with the <th> tag.

All major browsers display the text in the <th> element as bold and centered.

Try:

<DOCTYPE html>

<html>

<body>

<table>

<tr>

<th>Header 1</th>

<th>Header 2</th>

</tr>

<tr>

<td>row 1, cell 1</td>

<td>row 1, cell 2</td>

</tr>

<tr>

<td>row 2, cell 1</td>

<td>row 2, cell 2</td>

</tr>

</table>

</body>

</html>

Page 23: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 23

Lesson 21. HTML div Tag

The HTML <div> element is a block level element that can be used as a container

for grouping other HTML elements.

The <div> element has no special meaning. Except that, because it is a block level

element, the browser will display a line break before and after it.

When used together with CSS, the <div> element can be used to set style attributes

to large blocks of content.

Another common use of the <div> element, is for document layout. It replaces the

"old way" of defining layout using tables. Using <table> elements for layout is not

the correct use of <table>. The purpose of the <table> element is to display tabular

data.

Lesson 22. HTML <span> Tag

The HTML <span> element is an inline element that can be used as a container for

text.

The <span> element has no special meaning.

When used together with CSS, the <span> element can be used to set style

attributes to parts of the text.

Lesson 23. HTML Layouts

HTML Layouts

Page 24: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 24

Web page layout is very important to make your website look good.

Design your webpage layout very carefully.

Website Layouts

Most websites have put their content in multiple columns (formatted like a

magazine or newspaper).

Multiple columns are created by using <div> or <table> elements. CSS are used to

position elements, or to create backgrounds or colorful look for the pages.

Lesson 24. HTML Layouts – Using <div> Elements

The div element is a block level element used for grouping HTML elements.

Page 25: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 25

The following example uses five div elements to create a multiple column layout,

creating the same result as in the previous example:

Try:

<!DOCTYPE html>

<html>

<body>

<div id="container" style="width:500px">

<div id="header" style="background-color:#FFA500;">

<h1 style="margin-bottom:0;">Main Title of Web Page</h1>

</div>

<div id="menu" style="background-

color:#FFD700;height:200px;width:100px;float:left;">

<b>Menu</b>

<br>

HTML<br>

CSS<br>

JavaScript

</div>

<div id="content" style="background-

color:#EEEEEE;height:200px;width:400px;float:left;"> Content goes here

</div>

Page 26: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 26

<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">

Copyright © Sahalsoftware.com</div>

</div>

</body>

</html>

Lesson 25. HTML Layouts – Using Table

A simple way of creating layouts is by using the HTML <table> tag.

Multiple columns are created by using <div> or <table> elements. CSS are used to

position elements, or to create backgrounds or colorful look for the pages.

The following example uses a table with 3 rows and 2 columns - the first and last

row spans both columns using the colspan attribute:

<!DOCTYPE html>

<html>

<body>

<table style="margin-left:180px; margin-top:50px; " width="1000" border="10">

<tr>

Page 27: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 27

<td colspan="2" style="background-color:#FFA500;">

<h1>Main Title of Web Page</h1> </td>

</tr>

<tr>

<td style="background-color:#FFD700;width:100px;">

<b>Menu</b>

<br> HTML

<br> CSS

<br> JavaScript </td>

<td style="background-color:#EEEEEE;height:200px;width:400px;"> Content

goes here</td>

</tr>

<tr>

<td colspan="2" style="background-color:#FFA500;text-align:center;"> Copyright

© Sahalsoftware.com

</td>

</tr>

</table>

</body>

</html>

HTML Layout - Useful Tips

Page 28: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 28

Tip: The biggest advantage of using CSS is that, if you place the CSS code in an

external style sheet, your site becomes MUCH EASIER to maintain. You can

change the layout of all your pages by editing one file. To learn more about CSS,

in the next month.

Lesson 26. HTML Attributes

- HTML links are defined with the <a> tag. The link address is specified in

the href attribute:

- <a href="http://www.sahalsoftware.com">This is a link</a>

“ ‘ , . ; :

Always Quote Attribute Values

- Attribute values should always be enclosed in quotes.

- Double style quotes are the most common, but single style quotes are also

allowed.

Page 29: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 29

Tip: In some rare situations, when the attribute value itself contains quotes, it is

necessary to use single quotes: name=’John "ShotGun" Nelson'

HTML Tip: Use Lowercase Attributes

Attribute names and attribute values are case-insensitive.

However, Sahalsoftware Web Development Team recommends lowercase

attributes/attribute values in their HTML.

Lesson 27. HTML Output - Useful Tips

- You cannot be sure how HTML will be displayed. Large or small screens,

and resized windows will create different results.

- With HTML, you cannot change the output by adding extra spaces or extra

lines in your HTML code.

- The browser will remove extra spaces and extra lines when the page is

displayed. Any number of lines count as one line, and any number of spaces

count as one space.

Note: Browsers automatically add an empty line before and after a paragraph.

Don't Forget the End Tag:

Page 30: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 30

Most browsers will display HTML correctly even if you forget the end tag:

Example

<p> this is a paragraph

<p> this is another paragraph

The example above will work in most browsers, but don’t use it. Forgetting the end

tag can produce unexpected results or errors.

Note: Future version of HTML will not allow you to skip end tags.

Lesson 28. The HTML <meta> Element

The metadata can be used by browsers (how to display content or reload page),

search engines (keywords), or other web services.

<meta> tags always go inside the <head> element.

Refresh document every 30 seconds:

<meta http-equiv="refresh" content="30">

Page 31: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 31

Lesson 29. Lists

The most common HTML lists are ordered and unordered lists:

HTML Lists An ordered

list:

1. The first list item

2. The second list item

3. The third list item

An unordered list:

HTML Un-ordered Lists

<ul>

<li>Coffee</li>

<li>Milk</li>

</ul>

How the HTML code above looks in a browser:

HTML Ordered Lists

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.

The list items are marked with numbers.

<ol>

<li>Coffee</li>

<li>Milk</li>

</ol>

Page 32: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 32

How the HTML code above looks in a browser:

1. Coffee

2. Milk

Lesson 30. HTML Entities

HTML Entities

Some characters are reserved in HTML.

It is not possible to use the less than (<) or greater than (>) signs in your text,

because the browser will mix them with tags.

To actually display reserved characters, we must use character entities in the

HTML source code.

A character entity looks like this:

&entity_name;

OR

&#entity_number;

To display a less than sign we must write: &lt; or &#60;

Tip: The advantage of using an entity name, instead of a number, is that the

name is easier to remember. However, the disadvantage is that browsers may not

support all entity names (the support for entity numbers is very good).

Non-breaking Space

A common character entity used in HTML is the non-breaking space (&nbsp;).

Page 33: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 33

Browsers will always truncate spaces in HTML pages. If you write 10 spaces in

your text, the browser will remove 9 of them, before displaying the page. To add

spaces to your text, you can use the &nbsp; character entity.

HTML Useful Character Entities

Note: Entity names are case sensitive!

Result Description Entity Name Entity Number

non-breaking space &nbsp; &#160;

< less than &lt; &#60;

> greater than &gt; &#62;

& ampersand &amp; &#38;

¢ cent &cent; &#162;

£ pound &pound; &#163;

¥ yen &yen; &#165;

€ euro &euro; &#8364;

§ section &sect; &#167;

© copyright &copy; &#169;

® registered trademark &reg; &#174;

™ trademark &trade; &#8482;

Lesson 31. HTML5 Video - How It Works

To show a video in HTML5, this is all you need:

Example

<!doctype html>

<html>

Page 34: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 34

<body>

<video width="600" height="400" controls>

<source src="E:\Study\Sahalsoftware\IT\Quickbook\Lesson 01. Overview

Part1.mp4" type="video/mp4">

<source src="E:\Study\Sahalsoftware\IT\Quickbook\Lesson 01. Overview

Part1\movie.ogg" type="video/ogg">

Your browser does not support the video tag.

</video>

</body>

</html>

The control attribute adds video controls, like play, pause, and volume.

It is also a good idea to always include width and height attributes. If height and

width are set, the space required for the video is reserved when the page is loaded.

However, without these attributes, the browser does not know the size of the video,

and cannot reserve the appropriate space to it. The effect will be that the page

layout will change during loading (while the video loads).

You should also insert text content between the <video> and </video> tags for

browsers that do not support the <video> element.

The <video> element allows multiple <source> elements. <source> elements can

link to different video files. The browser will use the first recognized format.

Video Formats and Browser Support

Currently, there are 3 supported video formats for the <video> element: MP4,

WebM, and Ogg:

Page 35: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 35

Browser MP4 WebM Ogg

Internet Explorer YES NO NO

Chrome YES YES YES

Firefox NO

Update: Firefox 21 running

on Windows 7, Windows 8,

Windows Vista, and Android

now supports MP4

YES YES

Safari YES NO NO

Opera NO YES YES

Try Another Video

<!DOCTYPE html>

<html>

<body>

<div style="text-align:center">

<button onclick="playPause()">Play/Pause</button>

<button onclick="makeBig()">Big</button>

<button onclick="makeSmall()">Small</button>

<button onclick="makeNormal()">Normal</button>

<br>

<video id="video1" width="600">

<source src="E:\Study\Sahalsoftware\IT\Quickbook\Lesson 01. Overview

Part1.mp4" type="video/mp4">

<source src="E:\Study\Sahalsoftware\IT\Quickbook\Lesson 01. Overview

Part1.ogg" type="video/ogg">

Your browser does not support HTML5 video.

</video>

</div>

Page 36: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 36

<script>

var myVideo=document.getElementById("video1");

function playPause()

{

if (myVideo.paused)

myVideo.play();

else

myVideo.pause();

}

function makeBig()

{

myVideo.width=560;

}

function makeSmall()

{

myVideo.width=320;

}

function makeNormal()

{

myVideo.width=600;

}

</script>

<p>Sahalsoftware ka baro casharo IT oo ku anfacaya &nbsp;

&nbsp;&nbsp;&nbsp;<a href="http://www.sahalsoftware.com/"

target="_blank">HALKAN RIIX</a>.</p>

</body>

</html>

Page 37: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 37

Lesson 32. HTML5 Audio

HTML5 provides a standard for playing audio files.

Audio on the Web

Until now, there has not been a standard for playing audio files on a web page.

Today, most audio files are played through a plug-in (like flash). However,

different browsers may have different plug-ins.

HTML5 defines a new element which specifies a standard way to embed an audio

file on a web page: the <audio> element.

HTML5 Audio - How It Works

To play an audio file in HTML5, this is all you need:

Example

<audio controls>

<source src=" E:\Qiraa'o\[Quran] AbdulAzeez al-Ahmad [128Kbps]\012.ogg"

type="audio/ogg">

<source src=" E:\Qiraa'o\[Quran] AbdulAzeez al-Ahmad [128Kbps]\012.mp3"

type="audio/mpeg">

Your browser does not support the audio element.

</audio>

The control attribute adds audio controls, like play, pause, and volume.

You should also insert text content between the <audio> and </audio> tags for

browsers that do not support the <audio> element.

Page 38: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 38

The <audio> element allows multiple <source> elements. <source> elements can

link to different audio files. The browser will use the first recognized format.

Audio Formats and Browser Support

Currently, there are 3 supported file formats for the <audio> element: MP3, Wav,

and Ogg:

Browser MP3 Wav Ogg

Internet Explorer YES NO NO

Chrome YES YES YES

Firefox NO

Update: Firefox 21 running

on Windows 7, Windows 8,

Windows Vista, and Android

now supports MP3

YES YES

Safari YES YES NO

Opera NO YES YES

Lesson 33: HTML Color Code

Page 39: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 39

Modern browsers support 140 named colors, which are listed below. Use them in

your HTML and CSS by name, Hex color code or RGB value.

Example

<body style="background-color:Aqua;">

<body style="background-color:#7FFF00;">

<body style="background-color: rgb(255, 0, 0);">

Color Name HEX Color Shades Mix

AliceBlue #F0F8FF Shades Mix

AntiqueWhite #FAEBD7 Shades Mix

Aqua #00FFFF Shades Mix

Aquamarine #7FFFD4 Shades Mix

Page 40: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 40

Azure #F0FFFF Shades Mix

Beige #F5F5DC Shades Mix

Bisque #FFE4C4 Shades Mix

Black #000000 Shades Mix

BlanchedAlmond #FFEBCD Shades Mix

Blue #0000FF Shades Mix

BlueViolet #8A2BE2 Shades Mix

Brown #A52A2A Shades Mix

BurlyWood #DEB887 Shades Mix

CadetBlue #5F9EA0 Shades Mix

Chartreuse #7FFF00 Shades Mix

Page 41: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 41

Chocolate #D2691E Shades Mix

Coral #FF7F50 Shades Mix

CornflowerBlue #6495ED Shades Mix

Cornsilk #FFF8DC Shades Mix

Crimson #DC143C Shades Mix

Cyan #00FFFF Shades Mix

DarkBlue #00008B Shades Mix

DarkCyan #008B8B Shades Mix

DarkGoldenRod #B8860B Shades Mix

DarkGray #A9A9A9 Shades Mix

DarkGrey #A9A9A9 Shades Mix

Page 42: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 42

DarkGreen #006400 Shades Mix

DarkKhaki #BDB76B Shades Mix

DarkMagenta #8B008B Shades Mix

DarkOliveGreen #556B2F Shades Mix

DarkOrange #FF8C00 Shades Mix

DarkOrchid #9932CC Shades Mix

DarkRed #8B0000 Shades Mix

DarkSalmon #E9967A Shades Mix

DarkSeaGreen #8FBC8F Shades Mix

DarkSlateBlue #483D8B Shades Mix

DarkSlateGray #2F4F4F Shades Mix

Page 43: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 43

DarkSlateGrey #2F4F4F Shades Mix

DarkTurquoise #00CED1 Shades Mix

DarkViolet #9400D3 Shades Mix

DeepPink #FF1493 Shades Mix

DeepSkyBlue #00BFFF Shades Mix

DimGray #696969 Shades Mix

DimGrey #696969 Shades Mix

DodgerBlue #1E90FF Shades Mix

FireBrick #B22222 Shades Mix

FloralWhite #FFFAF0 Shades Mix

ForestGreen #228B22 Shades Mix

Page 44: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 44

Fuchsia #FF00FF Shades Mix

Gainsboro #DCDCDC Shades Mix

GhostWhite #F8F8FF Shades Mix

Gold #FFD700 Shades Mix

GoldenRod #DAA520 Shades Mix

Gray #808080 Shades Mix

Grey #808080 Shades Mix

Green #008000 Shades Mix

GreenYellow #ADFF2F Shades Mix

HoneyDew #F0FFF0 Shades Mix

HotPink #FF69B4 Shades Mix

Page 45: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 45

IndianRed #CD5C5C Shades Mix

Indigo #4B0082 Shades Mix

Ivory #FFFFF0 Shades Mix

Khaki #F0E68C Shades Mix

Lavender #E6E6FA Shades Mix

LavenderBlush #FFF0F5 Shades Mix

LawnGreen #7CFC00 Shades Mix

LemonChiffon #FFFACD Shades Mix

LightBlue #ADD8E6 Shades Mix

LightCoral #F08080 Shades Mix

LightCyan #E0FFFF Shades Mix

Page 46: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 46

LightGoldenRodYellow #FAFAD2 Shades Mix

LightGray #D3D3D3 Shades Mix

LightGrey #D3D3D3 Shades Mix

LightGreen #90EE90 Shades Mix

LightPink #FFB6C1 Shades Mix

LightSalmon #FFA07A Shades Mix

LightSeaGreen #20B2AA Shades Mix

LightSkyBlue #87CEFA Shades Mix

LightSlateGray #778899 Shades Mix

LightSlateGrey #778899 Shades Mix

LightSteelBlue #B0C4DE Shades Mix

Page 47: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 47

LightYellow #FFFFE0 Shades Mix

Lime #00FF00 Shades Mix

LimeGreen #32CD32 Shades Mix

Linen #FAF0E6 Shades Mix

Magenta #FF00FF Shades Mix

Maroon #800000 Shades Mix

MediumAquaMarine #66CDAA Shades Mix

MediumBlue #0000CD Shades Mix

MediumOrchid #BA55D3 Shades Mix

MediumPurple #9370DB Shades Mix

MediumSeaGreen #3CB371 Shades Mix

Page 48: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 48

MediumSlateBlue #7B68EE Shades Mix

MediumSpringGreen #00FA9A Shades Mix

MediumTurquoise #48D1CC Shades Mix

MediumVioletRed #C71585 Shades Mix

MidnightBlue #191970 Shades Mix

MintCream #F5FFFA Shades Mix

MistyRose #FFE4E1 Shades Mix

Moccasin #FFE4B5 Shades Mix

NavajoWhite #FFDEAD Shades Mix

Navy #000080 Shades Mix

OldLace #FDF5E6 Shades Mix

Page 49: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 49

Olive #808000 Shades Mix

OliveDrab #6B8E23 Shades Mix

Orange #FFA500 Shades Mix

OrangeRed #FF4500 Shades Mix

Orchid #DA70D6 Shades Mix

PaleGoldenRod #EEE8AA Shades Mix

PaleGreen #98FB98 Shades Mix

PaleTurquoise #AFEEEE Shades Mix

PaleVioletRed #DB7093 Shades Mix

PapayaWhip #FFEFD5 Shades Mix

PeachPuff #FFDAB9 Shades Mix

Page 50: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 50

Peru #CD853F Shades Mix

Pink #FFC0CB Shades Mix

Plum #DDA0DD Shades Mix

PowderBlue #B0E0E6 Shades Mix

Purple #800080 Shades Mix

RebeccaPurple #663399 Shades Mix

Red #FF0000 Shades Mix

RosyBrown #BC8F8F Shades Mix

RoyalBlue #4169E1 Shades Mix

SaddleBrown #8B4513 Shades Mix

Salmon #FA8072 Shades Mix

Page 51: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 51

SandyBrown #F4A460 Shades Mix

SeaGreen #2E8B57 Shades Mix

SeaShell #FFF5EE Shades Mix

Sienna #A0522D Shades Mix

Silver #C0C0C0 Shades Mix

SkyBlue #87CEEB Shades Mix

SlateBlue #6A5ACD Shades Mix

SlateGray #708090 Shades Mix

SlateGrey #708090 Shades Mix

Snow #FFFAFA Shades Mix

SpringGreen #00FF7F Shades Mix

Page 52: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 52

SteelBlue #4682B4 Shades Mix

Tan #D2B48C Shades Mix

Teal #008080 Shades Mix

Thistle #D8BFD8 Shades Mix

Tomato #FF6347 Shades Mix

Turquoise #40E0D0 Shades Mix

Violet #EE82EE Shades Mix

Wheat #F5DEB3 Shades Mix

White #FFFFFF Shades Mix

WhiteSmoke #F5F5F5 Shades Mix

Yellow #FFFF00 Shades Mix

Page 53: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 53

YellowGreen #9ACD32 Shades Mix

Lesson 34. RGB (Red, Green, Blue)

With HTML, RGB color values can be specified using this formula: rgb(red,

green, blue)

Each parameter (red, green, and blue) defines the intensity of the color

between 0 and 255.

For example, rgb(255,0,0) is displayed as red, because red is set to its highest

value (255) and the others are set to 0. Experiment by mixing the RGB values

below:

Red Green Blue

255 0 0

rgb(255, 0, 0)

Example

Color RGB

rgb(255,0,0)

Page 54: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 54

rgb(255,255,0)

rgb(0,255,0)

rgb(0,255,255)

rgb(0,0,255)

Hexadecimal Colors

With HTML, RGB values can also be specified using hexadecimal color values in

the form: #RRGGBB, where RR (red), GG (green) and BB (blue) are

hexadecimal values between 00 and FF (same as decimal 0-255).

For example, #FF0000 is displayed as red, because red is set to its highest

value (FF) and the others are set to the lowest value (00).

Example

Color HEX

#FF0000

#FFFF00

Page 55: HTML 5 Content - Sahalsoftware 5 Page 1 Content Lesson 01. Introduction Lesson 02. HTML Elements Lesson 03. HTML BASIC Lesson 04. HTML HEADING Lesson 05. HTML Paragraphs Lesson 06.

HTML 5

Page 55

#00FF00

#00FFFF

#0000FF

END