Você está na página 1de 124

HTML

Web development

SUPINFO International University http://www.supinfo.com

HTML

Objectives
At the end of this course you will be able to:
Use tools to work with HTML

Create a website with HTML


Validate your websites

Create forms with HTML

SUPINFO International University http://www.supinfo.com

HTML

Course plan
Introduction Basic HTML tags What else about HTML? Validation Forms
SUPINFO International University http://www.supinfo.com

HTML

INTRODUCTION
SUPINFO International University http://www.supinfo.com

Introduction

Presentation
An HTML file have the extension .html
An HTML file is constructed by predefined tag
Well learn the tags step by step

SUPINFO International University http://www.supinfo.com

Introduction

Presentation
Tags surrounded by < and >
<tag_name>

2 types of tags:
Pairs one:
<p></p>

Empty one:
<br />

Tags names are always lowercases in XHTML


SUPINFO International University http://www.supinfo.com

Introduction

Block tags
Datas layout Displayed on vertical axe Used to structure the page with different "blocks" Examples: <p>, <h1>, <h2>, etc
SUPINFO International University http://www.supinfo.com

Introduction

Inline tags
Formatting data Displayed by horizontal axe Must be surrounded by Block tags Examples: <span>, <em>, <strong>, etc
SUPINFO International University http://www.supinfo.com

Introduction

Tools
A lot of tools are available ! To write HTML :
Source code editors :
Notepad++ TextMate

IDE :
Adobe Dreamweaver Aptana WebStorm

SUPINFO International University http://www.supinfo.com

Introduction

Tools
A lot of tools are available ! To edit, debug, monitor HTML, CSS, and JS live in your browser:
On Firefox: Firebug extension Chrome and Opera have a built-in inspector

SUPINFO International University http://www.supinfo.com

Questions ?

SUPINFO International University http://www.supinfo.com

HTML

BASIC HTML TAGS


SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step by step
Were going to write a simple web page
A simple Resume

In order to discover some basic HTML tags Without CSS for now
At the end, youll design your own Resume !

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step by step
Page Title Main Title

Links to anchors
Imag e Paragraph

Ordered list

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step by step
Unordered list Secondary Title

Table

Hyperlink
SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 1: Structure
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> </head> <body> </body> </html>

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 1: Structure
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Declares to the browser the Document Type Definition (DTD) to which the document conforms
Needed in XHTML!

A Document Type Declaration should be placed before the root element


We always choose the strict validation for this course
SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 1: Structure
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > ... </html>

Block type tag Root of the document Contains <head> and <body> tags
SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 1: Structure
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > ... </html>

Two required attributes:


xmlns xml:lang
In XHTML 1.1, we must precise the namspace used by the

document and his language (no conflict)

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 1: Structure
<head> ... </head>

Block type tag containing headers:


<title>
Page's title (for example, its the name of the window browser)

<style> and <link />


Include styles (CSS)

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 1: Structure
<head> ... </head>

Block type tag containing headers:


<script>
Include JavaScript

<meta />
Help for referencing

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 1: Structure
<body> ... </body>

Block type tag containing headers:


Contains all the element which describe the content of the document
Paragraphs Images Etc

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 2: Page title


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title>My resume</title> </head> <body> </body> </html>

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 3: Titles
<hn>...</hn> Six tags defining titles:
<h1>This is heading 1</h1> <h3>This is heading 3</h3> <h5>This is heading 5</h5> <h2>This is heading 2</h2> <h4>This is heading 4</h4>

<h6>This is heading 6</h6>

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 3: Titles
... <body> <h1>Brice ARGENSON</h1> <h3>Programming Language</h3> <h3>Foreign Languages</h3> <h3>More about me ?</h3> </body> ...

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 4: Paragraphs
<p>...</p> Defines a paragraph Automatically adds a new line <br /> Used to break a line Empty tag
SUPINFO International University http://www.supinfo.com

... <body> <p>First Paragraph</p> <p>Second <br/> Paragraph</p> </body> ...

<body> <h1>Brice ARGENSON</h1> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer tincidunt purus non enim semper tempor sed vitae erat. <br/>

Paragraphs

Donec eu velit non nunc hendrerit pulvinar. Sed commodo neque at nibh rhoncus ut tincidunt purus semper. </p> <h3>Programming Languages</h3> ...

<h3>More about me?</h3> <p> One solution : Googlize me ! </p> </body>


SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 4: Paragraphs

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 5: Lists
<ol>...</ol> Defines an Ordered list Each element is defined by: <li></li>
<ol> <li>HTML</li> <li>Javascript</li> </ol>

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 5: Lists
<ul>...</ul> Defines an Unordered list Each element is defined by: <li></li>
<ul> <li>HTML</li> <li>Javascript</li> </ul>

SUPINFO International University http://www.supinfo.com

Lists

... <body> <h1>Brice ARGENSON</h1> <ol> <li>Programming Languages</li> <li>Operating Systems</li> <li>Foreign Languages</li> </ol> ... <h3>Programming Languages</h3> <ul> <li>PHP</li> <li>Ruby</li> <li>JavaScript</li> </ul> </body> ...

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 5: Lists

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 6: Links and anchors


<a>...</a> Used to create:
A link to another resource

Three types:
Absolute links
<a href="http://web.com/Path/file.html">My link</a>

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 6: Links and anchors


Three types:
Relative links
<a href="file.html">My link</a>

Anchor links
Direct jump to a specific section of a document
<a href="file.html#myAnchor">My link</a>

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 6: Links and anchors


Two ways to create a named anchor:
Use the name attribute of <a> tag
But not supported in HTML 5
<a name="myAnchor">My text</a>

Use the id attribute available in any tag (preferred)


<a href="file.html#myAnchor">My link</a>

SUPINFO International University http://www.supinfo.com

Links and anchors

... <h1>Brice <ol> <li><a <li><a <li><a </ol>


...

ARGENSON</h1> href="#Dev">Programming Languages</a></li> href="#OS">Operating Systems</a></li> href="#Foreign">Foreign Languages</a></li>

<h3 id="Dev">Programming Languages</h3> ...

<h3 id="OS">Operating Systems</h3> ...


<h3><a name="Foreign">Foreign Languages</a></h3> ...

SUPINFO International University http://www.supinfo.com

...

Links and anchors

<h3>More about me?</h3>


<p> One solution: <a href="http://www.google.fr/#q=%22Brice+Argenson%2 2"> Googlize me! </a> </p> ...

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 6: Links and anchors

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 7: Pictures
Used to display a picture, empty tag Two attributes required:
src="url" alt="alternative text"

Title: tool tip


SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 7: Pictures
Example:
<img src="picture.jpg" alt="A picture" title="My picture" />

RULES about attributes:


Must be written in the start tag Attribute names in lowercase in XHTML

SUPINFO International University http://www.supinfo.com

...

<h1>Brice ARGENSON</h1>

Pictures

<img src="tux-brice.png" alt="A picture" title="My picture" />

<ol> <li><a href="#Dev">Programming Languages</a></li> <li><a href="#OS">Operating Systems</a></li> <li><a href="#Foreign">Foreign Languages</a></li> </ol>
...

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 7: Pictures

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 8: Tables
<table>...</table> Divided into rows (Table Rows): <tr>...</tr>

Each row may contains:


Headers (Table Header): <th>...</th> Datas (Table Data): <td>...</td>

Tags td and th makes cells!


SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 8: Tables
<table>...</table> Usages:
Classification of data Display in tabular format

Bad usage:
Layout!
SUPINFO International University http://www.supinfo.com

<table> <tr> <th>Line <th>Line </tr> <tr> <td>Line <td>Line </tr> <tr> <td>Line <td>Line </tr> </table>

1, Header 1</th> 1, Header 2</th>

Tables - Example

2, Cell 1</td> 2, Cell 2</td>

3, Cell 1</td> 3, Cell 2</td>

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 8: Tables
Merging cells Two attributes:
colspan: width in number of cells rowspan: height in number of cells

Of course you can use both colspan and rowspan on the same cell
SUPINFO International University http://www.supinfo.com

<table> <tr> <th colspan="2">Header</th> </tr> <tr> <td>1</td> <td rowspan="2">Merging two lines</td> </tr> <tr> <td>2</td> </tr> <tr> <td colspan="2"> Fusionning two cells </td> </tr> </table>

SUPINFO International University http://www.supinfo.com

Tables Merge example

...
<h3><a name="Foreign">Foreign Languages</a></h3>

<table> <tr> <th colspan="2" rowspan="2"></th> <th colspan="5">Level</th> </tr> <tr> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> </tr>
...

SUPINFO International University http://www.supinfo.com

Tables

...
<tr> <th rowspan="3">English</th> <th>Read</th> <td></td><td></td><td></td><td></td><td>X</td> </tr> <tr> <th>Spoken</th> <td></td><td></td><td>X</td><td></td><td></td> </tr> <tr> <th>Written</th> <td></td><td></td><td></td><td>X</td><td></td> </tr> </table> ...
SUPINFO International University http://www.supinfo.com

Tables

Basic HTML tags

Step 8: Tables

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 8: Tables
Why the table doesnt have border? You have to use CSS to declare table style Or use the border attribute of the table tag
Deprecated! But useful cause you dont know CSS yet

SUPINFO International University http://www.supinfo.com

Basic HTML tags

Step 8: Tables
<h3><a name="Foreign">Foreign Languages</a></h3> <table border="1"> ... </table>

SUPINFO International University http://www.supinfo.com

Questions ?

SUPINFO International University http://www.supinfo.com

HTML

WHAT ELSE ?
SUPINFO International University http://www.supinfo.com

What else ?

Comments
Invisible to Web browsers Utilities:
Projects resumption after a long time Projects resumption by an other web developer Team working

<!- This is a comment that can help you in the future -->

SUPINFO International University http://www.supinfo.com

What else ?

Special characters
Characters entities for some special characters Main case:
& <HTML Code or # + unicode> ;

Example:
<p> Web'n'Dev &#169; </p>

SUPINFO International University http://www.supinfo.com

What else ?

Specials characters
Spaces are trimmed in HTML
Many spaces will be merged into one
<p> Web'n'Dev rocks</p>

You can use &nbsp; (Non Breakable SPace)


<p> Web'n'Dev&nbsp;&nbsp;&nbsp;rocks</p>

SUPINFO International University http://www.supinfo.com

What else ?

Specials characters
Special case for the accents Rule: & + used letter + abbrevation + ;
Description Abbreviation

Grave accent
Acute accent Circumflex accent Cedilla Umlaut mark Tilde
SUPINFO International University http://www.supinfo.com

grave
acute circ cedil uml tilde

What else ?

Specials characters
Examples:

Code

Display

&egrave;
&eacute; &acirc; &ccedil; &uuml; &tilde;
SUPINFO International University http://www.supinfo.com

What else ?

Other HTML tags


There are a lot of other tags in XHTML.

You can find a list of them here: http://www.w3schools.com/tags/default.asp

SUPINFO International University http://www.supinfo.com

Questions ?

SUPINFO International University http://www.supinfo.com

HTML

Exercices
Its your turn to work! Create your own Resume
With a complete civil status A picture representing you A quick description of yourself Your education All your competences Your professional experiences Your hobbies

SUPINFO International University http://www.supinfo.com

HTML

VALIDATION
SUPINFO International University http://www.supinfo.com

Validation

Definition

Validate Fact to confirm that requirements have been met.

SUPINFO International University http://www.supinfo.com

Validation

Why validate?
Validate is essential for normalization:
Universal accessibility Portability Speed production Easily controls Documents durability Referencing

SUPINFO International University http://www.supinfo.com

Validation

Validation types
There are three validation types:
Transitional Frameset Strict

Were going to see them in more details


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>

SUPINFO International University http://www.supinfo.com

Validation

Transitional
Use normalization smooth Accept some banned tags
<font/> <center/>

Inadvisable to use!
SUPINFO International University http://www.supinfo.com

Validation

Frameset
Frames, though normalizations Accept some banned tags Use <iframe> tag <body> tag replaced by <frameset>

SUPINFO International University http://www.supinfo.com

Validation

Strict
Coding properly! Dont accept style tags
<font/> <center />

Advised to use! We always use the strict validation!


SUPINFO International University http://www.supinfo.com

Validation

Validate!
http://validator.w3.org/ Possibility to validate by:
URI, file upload, copy of source code

Limit:
Validation for only one page

Advice: if you have several errors, always correct the first one, and revalidate your document.
SUPINFO International University http://www.supinfo.com

Validation

Validate!
http://www.validateur.ca/ Multi-pages validator Use the W3C validation service English and French version

SUPINFO International University http://www.supinfo.com

Questions ?

SUPINFO International University http://www.supinfo.com

HTML

Exercices
Try to validate some websites:
http://www.google.com http://www.supinfo.com http://www.w3.org

Validate your Resume webpage


Validation type must be Strict Correct your HTML code if needed

SUPINFO International University http://www.supinfo.com

HTML

FORMS
SUPINFO International University http://www.supinfo.com

Forms

Usages
Very important for dynamic web Allows user to insert datas Sending and receiving datas

SUPINFO International University http://www.supinfo.com

Forms

Main structure
<form id="myForm" action="page.html" method="post"> <!- Form codes --> </form>

Attributes:
Action: page handling data Method: Submitting methods

Attribute name forbidden!

SUPINFO International University http://www.supinfo.com

Forms

Submitting methods - GET


Data sent by the URL
<URI>?name1=value1&name2=value2

Security troubles Authorized number of characters depends on the browser (Some are limited to 255)

SUPINFO International University http://www.supinfo.com

Forms

Submitting methods - POST


Data sent by the HTTP request body
Almost unlimited authorized number of characters Invisible to the user in his browser Still visible in the HTTP request message

Just a little more secure than GET

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type text
Displays text fields Optionals attributes: size, maxlength,
<input type="text" name="firstname" value="textfield" />

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type password
Characters entered by the user are replaced by *

<input type="password" name="pass" value="1234" />

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type checkbox
Displays a checkbox to select or unselect Optional attribute: checked
<input type="checkbox" name="day" value="6" checked="checked" /> Saturday

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type radio
User can choose between different options

<input type="radio" name="sex" value="m" /> Man <input type="radio" name="sex" value="f" checked="checked" /> Woman

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type submit
Button Send forms datas
<input type="submit" value="Send contents" />

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type reset
Button Reset all the controls values
<input type="reset" value="Reset values" />

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type button
Button Doesnt implement specific functionnalities
<input type="button" value="No Action" />

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type image
Displays an image Works as a submit input
<input type="image" src="go.png" alt="Go" />

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type hidden
Hidden control Invisible to the user

<input type="hidden" name="hide" value="Invisible" />

SUPINFO International University http://www.supinfo.com

Forms

Input elements
The input tag:
Type file
Files selection POST method and attribute enctype required in <form>
<form id="form1" method="post" enctype="multipart/form-data"> <input type="file" name="file_send" /> </form>

SUPINFO International University http://www.supinfo.com

Forms

Other elements
The button tag:
Displays a specific button
HTML can be displayed inside
<button name="send" type="submit"> Envoyer <img src="accept.png" alt="wow" /> </button> &nbsp; &nbsp; &nbsp; &nbsp; <button name="delete" type="reset"> Effacer <img src="delete.png" alt="oops" /> </button>

SUPINFO International University http://www.supinfo.com

Forms

Other elements
Menus:
Tags
<select></select> <optgroup></optgroup> <option></option>

Attributes
size multiple selected
SUPINFO International University http://www.supinfo.com

Forms

Other elements
Menus:
<select name="FrenchDepartments"> <optgroup label="Alsace"> <option value="67">Bas-Rhin</option> <option value="68">Haut-Rhin</option> </optgroup> <optgroup label="Corse"> <option value="2B">Haute-Corse</option> <option value="2A">Corse-du-Sud</option> </optgroup> </select>

SUPINFO International University http://www.supinfo.com

Forms

Other elements
Labels:
Tag <label></label> Used to identify controls Implicit version:
<label> <input type="radio" name="sex" value="h" /> Homme </label>

SUPINFO International University http://www.supinfo.com

Forms

Other elements
Labels:
Tag <label></label> Used to identify controls Explicit version:
<input type="radio" name="sex" value="f" id="femme" /> <label for="femme">Femme</label>

Prefer to use the explicit way


Easier to manage CSS later
SUPINFO International University http://www.supinfo.com

Forms

Other elements
Textarea:
Text field that may content many lines Attributes: cols, rows
<textarea cols="25" rows="10" name="comments"> Put your text here </textarea>

SUPINFO International University http://www.supinfo.com

Forms

Other elements
Fieldset and legend:
Aggregate controls around a thematic
<fieldset> <legend>Informations</legend> <label for="last">Lastname:</label> <input type="text" name="last" /> <label for="first">Firstname :</label> <input type="text" name="first" /> </fieldset>

SUPINFO International University http://www.supinfo.com

Forms

Specifics attributes
Type hidden
readonly (<input/>, <textarea/>) disabled (<button/>, <input/>, <optgroup/>, <option/>, <select/>, <textarea/>)

SUPINFO International University http://www.supinfo.com

Forms

Specifics attributes
Accessibility attributes
tabindex (<a>,<input/>, <button>, <select/>,<textarea/>)

accesskey (<a>,<input/>, <button>, <label/>,<legend/>,<textarea/>)

SUPINFO International University http://www.supinfo.com

Questions ?

SUPINFO International University http://www.supinfo.com

Forms

Exercices
Create a new HTML page named contact.html and reproduce this form:

Add a hyperlink to this form in your Resume


SUPINFO International University http://www.supinfo.com

HTML

INTRODUCTION TO HTML5
SUPINFO International University http://www.supinfo.com

Semantic markups

Semantic
Most websites have some common uses of generic blocks:
<div id="header"> <div id="nav"> <div class="article"> <div id="sidebar">

<div class="section">
<div id="footer">

SUPINFO International University http://www.supinfo.com

Semantic markups

Semantic
HTML5 introduces the following new markups:
<header> <nav> <article> <sidebar>

<section>
<footer>

SUPINFO International University http://www.supinfo.com

<body> <header><!-- Header content --></header> <article> <section> <!-- Section content --> </section> <section> <!-- Other section content --> </section> </article> <aside> <!-- Aside content --> </aside> <footer><!-- Footer content --></footer> </body>

SUPINFO International University http://www.supinfo.com

Semantic Example

Semantic markups

Section
The section element represents a generic section of a document
A chapter for example
<section> <h1>Chapter 2 : Basic HTML tags</h1> <p> HTML markup consists of several key components, including elements [], character-based data types, character references and entity references

</p>
</section>
SUPINFO International University http://www.supinfo.com

Semantic markups

Section
The section element is not a generic container element
Use div when an element is needed only for styling purposes or as a convenience for scripting Use article when it would make sense to syndicate the contents of the element

SUPINFO International University http://www.supinfo.com

Semantic markups

Article
The article element represents a self-contained composition independently distributable or reusable
News Blog posts

<article id="comment-6"> <header> <h4>John Doe</h4> </header> <p>Very good course ;-)</p> </article>

SUPINFO International University http://www.supinfo.com

Semantic markups

Nav
The nav element represents a section of navigation links
<nav> <h1>Navigation</h1> <ul> <li><a href="/">Home</a></li> <li><a href="/about.html">About</a></li> </ul> </nav>

SUPINFO International University http://www.supinfo.com

Semantic markups

Header
The header element represents the header of a section

<header> <h1>Introduction to HTML5</h1> <p class="author-line">By Brice Argenson</p> </header>

SUPINFO International University http://www.supinfo.com

Semantic markups

Footer
The footer element represents a footer for its nearest ancestor sectioning content

<footer> <p> 2012 SUPINFO International University</p> </footer>

SUPINFO International University http://www.supinfo.com

Introduction to HTML 5

Aside
The aside element is for content that is tangentially related to the content around it
Useful for marking up sidebars
<aside> <h1>Archives</h1> <ul> <li><a href="/2012/01/">January 2012</a></li> <li><a href="/2012/02/">February 2012</a></li> </ul> </aside>

SUPINFO International University http://www.supinfo.com

Media Markups

Audio & Video


There are more and more Audio and Video on the web Until now, you had to use non standardize technologies like Java Applets or Flash
Need specific plug-in

SUPINFO International University http://www.supinfo.com

Media Markups

Audio
The audio new element represents a sound or audio stream

Content may be provided inside the audio element


User agents should show this content to the user only if they dont support the audio element

SUPINFO International University http://www.supinfo.com

Media Markups

Audio
Example :
<audio src="http://images.wikia.com/starwars/images/3/38/UlicFal ls.ogg" controls> Your browser doesn't support the HTML5 audio element. </audio>

SUPINFO International University http://www.supinfo.com

Media Markups

Video
The new video element is used for playing videos and audio files with captions

Again, content may be provided inside the video element


User agents should show this content to the user only if they dont support the video element

SUPINFO International University http://www.supinfo.com

Media Markups

Video
Example :
<video src="myVideo.mp4" poster="movie.jpg" controls> Your browser doesn't support the HTML5 video element. </video>

SUPINFO International University http://www.supinfo.com

Media Markups

Common attributes
audio and video have some common attributes
preload: to pre-download the media resource autoplay: to automatically begin playback of the media resource

SUPINFO International University http://www.supinfo.com

Media Markups

Common attributes
audio and video have some common attributes
controls: to ask to the user agent to provide its own set of controls loop: to seek back to the start of the media resource upon reaching the end

SUPINFO International University http://www.supinfo.com

Media Markups

Alternative sources
The source element allows to specify multiple alternative of sources to a media element
Allows the browser to choose the better source based on its media type or codec support

SUPINFO International University http://www.supinfo.com

Media Markups

Alternative sources
Example:
<audio controls autoplay loop>

<source src="song.ogg" type="audio/ogg" />


<source src="song.mp3" type="audio/mpeg" />

Your browser doesn't support the HTML5 audio element.


</video>

SUPINFO International University http://www.supinfo.com

Media Markups

Support for audio codecs


Browser Internet Explorer Firefox Google Chrome Apple Safari Opera Android iOS Blackberry Version 9.0+ 3.6+ 6.0+ 5.0+ 10.0+ 2.3+ 3.0+ 6.0+ Codec Support MP3, AAC Ogg Vorbis, WAV Ogg Vorbis, MP3, WAV (since Chrome 9)

MP3, AAC, WAV Ogg Vorbis, WAV MP3, AAC (device dependent) MP3, AAC MP3, AAC

SUPINFO International University http://www.supinfo.com

Media Markups

Support for video codecs


Browser Internet Explorer Firefox Google Chrome Apple Safari Version 9.0+ 4.0+ 6.0+ 5.0+ MP4 WebM, Ogg MP4, WebM, Ogg MP4 WebM, Ogg MP4, WebM (since 4.0) MP4 Codec Support

Opera Android iOS

10.6+ 2.3+ 3.0+

SUPINFO International University http://www.supinfo.com

Questions ?

SUPINFO International University http://www.supinfo.com

Introduction to HTML 5

Exercices
Create a new HTML5 page
Try the two Audio and Video elements!

SUPINFO International University http://www.supinfo.com

HTML

The end

Thanks for your attention


SUPINFO International University http://www.supinfo.com

Você também pode gostar