HTML5 Notes for Professionals

Programming · notes

Browse all développement web documents

HTML5

Notes for Professionals

HTML5

Notes for Professionals

100+ pages

of professional hints and tricks

GoalKicker.com

Free Programming Books

Disclaimer

This is an unocial free book created for educational purposes and is

not aliated with ocial HTML5 group(s) or company(s).

All trademarks and registered trademarks are

the property of their respective owners

Contents

About

...................................................................................................................................................................................

1

Chapter 1: Getting started with HTML

................................................................................................................

2

Section 1.1: Hello World

Chapter 2: Doctypes

.................................................................................................................................................

2

....................................................................................................................................................

5

Section 2.1: Adding the Doctype

Section 2.2: HTML 5 Doctype

..................................................................................................................................

5

.......................................................................................................................................

5

Chapter 3: Headings

....................................................................................................................................................

6

Section 3.1: Using Headings

..........................................................................................................................................

6

Chapter 4: Paragraphs

..............................................................................................................................................

7

.....................................................................................................................................

.....................................................................................................................................

................................................................................................................................................

........................................................................................................................

..............................................................................................................................................

Section 4.1: HTML Paragraphs

Chapter 5: Text Formatting

Section 5.1: Highlighting

Section 5.2: Bold, Italic, and Underline

Section 5.3: Abbreviation

Section 5.4: Inserted, Deleted, or Stricken

Section 5.5: Superscript and Subscript

Chapter 6: Anchors and Hyperlinks

...................................................................................................................

9

........................................................................................................................

9

...................................................................................................................

..................................................................................................................................

....................................................................................................................................

............................................................................................................

12

........................................................................................................................

................................................................................................................

.......................................................................................................................

......................................................................................................................

Section 6.1: Link to another site

Section 6.2: Link to an anchor

Section 6.3: Link to a page on the same site

Section 6.4: Link that dials a number

Section 6.5: Open link in new tab/window

Section 6.6: Link that runs JavaScript

Section 6.7: Link that runs email client

Chapter 7: Lists

............................................................................................................................................................

15

Section 7.1: Ordered List

Section 7.2: Unordered List

Section 7.3: Nested lists

Section 7.4: Description List

..............................................................................................................................................

........................................................................................................................................

..............................................................................................................................................

........................................................................................................................................

17

Chapter 8: Tables

.......................................................................................................................................................

19

Section 8.1: Simple Table

Section 8.2: Spanning columns or rows

Section 8.3: Column Groups

Section 8.4: Table with thead, tbody, tfoot, and caption

Section 8.5: Heading scope

............................................................................................................................................

....................................................................................................................

.......................................................................................................................................

........................................................................................................................................

22

.........................................................................................

21

Chapter 9: Comments

...............................................................................................................................................

24

Section 9.1: Creating comments

Section 9.2: Commenting out whitespace between inline elements

.................................................................................................................................

24

......................................................................

24

Chapter 10: Classes and IDs

..................................................................................................................................

26

Section 10.1: Giving an element a class

Section 10.2: Giving an element an ID

Section 10.3: Acceptable Values

Section 10.4: Problems related to duplicated IDs

.....................................................................................................................

.......................................................................................................................

.................................................................................................................................

.....................................................................................................

29

Chapter 11: Data Attributes

...................................................................................................................................

30

Section 11.1: Older browsers support

Section 11.2: Data Attribute Use

.........................................................................................................................

30

.................................................................................................................................

30

Advertisement

7

8

8

8

9

11

11

12

12

13

13

14

15

16

17

19

19

20

26

27

27

Chapter 12: Linking Resources

.............................................................................................................................

31

...............................................................................................................................................

........................................................................................................................

...................................................................................................................................................

......................................................................................................................................

Section 12.1: JavaScript

Section 12.2: External CSS Stylesheet

Section 12.3: Favicon

Section 12.4: Alternative CSS

Section 12.5: Resource Hint: dns-prefetch, prefetch, prerender

Section 12.6: Link 'media' attribute

Section 12.7: Prev and Next

Section 12.8: Web Feed

............................................................................................................................

........................................................................................................................................

...............................................................................................................................................

.............................................................................

33

Chapter 13: Include JavaScript Code in HTML

.............................................................................................

35

Section 13.1: Handling disabled Javascript

Section 13.2: Linking to an external JavaScript file

Section 13.3: Directly including JavaScript code

Section 13.4: Including a JavaScript file executing asynchronously

...............................................................................................................

..................................................................................................

......................................................................................................

......................................................................

35

Chapter 14: Using HTML with CSS

......................................................................................................................

36

Section 14.1: External Stylesheet Use

Section 14.2: Internal Stylesheet

Section 14.3: Inline Style

Section 14.4: Multiple Stylesheets

.........................................................................................................................

36

.................................................................................................................................

36

..............................................................................................................................................

...............................................................................................................................

Chapter 15: Images

....................................................................................................................................................

38

Section 15.1: Creating an image

Section 15.2: Choosing alt text

Section 15.3: Responsive image using the srcset attribute

Section 15.4: Responsive image using picture element

.................................................................................................................................

....................................................................................................................................

.....................................................................................

39

...........................................................................................

40

Chapter 16: Image Maps

..........................................................................................................................................

41

Section 16.1: Introduction to Image Maps

Chapter 17: Input Control Elements

..................................................................................................................

41

..................................................................................................................

..........................................................................................................................................................

...............................................................................................................

44

......................................................................................................................................

Section 17.1: Text

Section 17.2: Checkbox and Radio Buttons

Section 17.3: Input Validation

Section 17.4: Color

Section 17.5: Password

Section 17.6: File

Section 17.7: Button

Section 17.8: Submit

Section 17.9: Reset

Section 17.10: Hidden

Section 17.11: Tel

Section 17.12: Email

Section 17.13: Number

Section 17.14: Range

Section 17.15: Search

Section 17.16: Image

Section 17.17: Week

Section 17.18: Url

Section 17.19: DateTime-Local

Section 17.20: Month

Section 17.21: Time

Section 17.22: DateTime (Global)

Section 17.23: Date

........................................................................................................................................................

................................................................................................................................................

...........................................................................................................................................................

.....................................................................................................................................................

.....................................................................................................................................................

.......................................................................................................................................................

...................................................................................................................................................

...........................................................................................................................................................

......................................................................................................................................................

..................................................................................................................................................

....................................................................................................................................................

....................................................................................................................................................

.....................................................................................................................................................

......................................................................................................................................................

..........................................................................................................................................................

....................................................................................................................................

....................................................................................................................................................

Advertisement

.......................................................................................................................................................

...............................................................................................................................

......................................................................................................................................................

31

32

32

32

33

33

33

35

35

35

37

37

38

38

43

43

46

47

48

48

49

50

50

50

50

51

51

51

51

51

52

52

52

52

52

53

53

Chapter 18: Forms

......................................................................................................................................................

54

...............................................................................................................................................

54

Section 18.1: Submitting

Section 18.2: Target attribute in form tag

Section 18.3: Uploading Files

Section 18.4: Grouping a few input fields

.................................................................................................................

55

......................................................................................................................................

..................................................................................................................

Chapter 19: Div Element

Section 19.1: Basic usage

Section 19.2: Nesting

..........................................................................................................................................

57

.............................................................................................................................................

...................................................................................................................................................

Chapter 20: Sectioning Elements

.......................................................................................................................

59

Section 20.1: Nav Element

Section 20.2: Article Element

Section 20.3: Main Element

Section 20.4: Header Element

Section 20.5: Footer Element

Section 20.6: Section Element

..........................................................................................................................................

......................................................................................................................................

........................................................................................................................................

....................................................................................................................................

62

.....................................................................................................................................

....................................................................................................................................

Chapter 21: Navigation Bars

.................................................................................................................................

64

Section 21.1: Basic Navigation Bar

Section 21.2: HTML5 Navigation Bar

.............................................................................................................................

64

.........................................................................................................................

64

Chapter 22: Label Element

Section 22.1: About Label

Section 22.2: Basic Use

.....................................................................................................................................

65

............................................................................................................................................

...............................................................................................................................................

Chapter 23: Output Element

.................................................................................................................................

67

Section 23.1: Output Element Using For and Form Attributes

Section 23.2: Output Element with Attributes

................................................................................

67

...........................................................................................................

Chapter 24: Void Elements

Section 24.1: Void elements

Chapter 25: Media Elements

....................................................................................................................................

........................................................................................................................................

.................................................................................................................................

69

.......................................................................................................................................................

......................................................................................................................................................

Section 25.1: Audio

Section 25.2: Video

Section 25.3: Using <video> and <audio> element to display audio/video content

Section 25.4: Video header or background

..............................................................................................................

70

.........................................

69

Chapter 26: Progress Element

.............................................................................................................................

71

Section 26.1: Progress

Section 26.2: Changing the color of a progress bar

Section 26.3: HTML Fallback

......................................................................................................................................

72

................................................................................................

71

.................................................................................................................................................

71

Chapter 27: Selection Menu Controls

...............................................................................................................

Advertisement

73

Section 27.1: Select Menu

Section 27.2: Options

Section 27.3: Option Groups

Section 27.4: Datalist

Chapter 28: Embed

............................................................................................................................................

..................................................................................................................................................

.......................................................................................................................................

74

...................................................................................................................................................

Section 28.1: Basic usage

Section 28.2: Defining the MIME type

....................................................................................................................................................

............................................................................................................................................

........................................................................................................................

76

Chapter 29: IFrames

..................................................................................................................................................

77

Section 29.1: Basics of an Inline Frame

Section 29.2: Sandboxing

Section 29.3: Setting the Frame Size

Section 29.4: Using the "srcdoc" Attribute

.....................................................................................................................

...........................................................................................................................................

.........................................................................................................................

................................................................................................................

78

55

55

57

57

59

60

61

63

63

65

65

67

68

68

69

69

73

73

74

76

76

77

77

77

Section 29.5: Using Anchors with IFrames

................................................................................................................

78

Chapter 30: Content Languages

.........................................................................................................................

79

Section 30.1: Base Document Language

Section 30.2: Element Language

Section 30.3: Elements with Multiple Languages

Section 30.4: Regional URLs

Section 30.5: Handling Attributes with Dierent Languages

..................................................................................................................

...............................................................................................................................

.....................................................................................................

.......................................................................................................................................

..................................................................................

79

Chapter 31: SVG

...........................................................................................................................................................

81

Section 31.1: Inline SVG

Section 31.2: Embedding external SVG files in HTML

Section 31.3: Embedding SVG using CSS

...............................................................................................

81

...................................................................................................................

82

................................................................................................................................................

81

Chapter 32: Canvas

....................................................................................................................................................

83

Section 32.1: Basic Example

Section 32.2: Drawing two rectangles on a <canvas>

........................................................................................................................................

83

.............................................................................................

83

Chapter 33: Meta Information

Section 33.1: Page Information

Section 33.2: Character Encoding

Section 33.3: Robots

Section 33.4: Social Media

Section 33.5: Mobile Layout Control

Section 33.6: Automatic Refresh

Section 33.7: Phone Number Recognition

Section 33.8: Automatic redirect

Section 33.9: Web App

..............................................................................................................................

...................................................................................................................................

..............................................................................................................................

....................................................................................................................................................

..........................................................................................................................................

..........................................................................................................................

................................................................................................................................

.................................................................................................................

88

................................................................................................................................

................................................................................................................................................

Chapter 34: Marking up computer code

Section 34.1: Block with <pre> and <code>

Section 34.2: Inline with <code>

Chapter 35: Marking-up Quotes

........................................................................................................

90

...............................................................................................................

.................................................................................................................................

..........................................................................................................................

Section 35.1: Inline with <q>

Section 35.2: Block with <blockquote>

........................................................................................................................................

......................................................................................................................

91

Chapter 36: Tabindex

................................................................................................................................................

93

Section 36.1: Add an element to the tabbing order

Section 36.2: Remove an element from the tabbing order

Advertisement

Section 36.3: Define a custom tabbing order (not recommended)

.................................................................................................

....................................................................................

.......................................................................

93

Chapter 37: Global Attributes

...............................................................................................................................

94

Section 37.1: Contenteditable Attribute

.....................................................................................................................

94

Chapter 38: HTML 5 Cache

.....................................................................................................................................

95

Section 38.1: Basic Example of HTML5 cache

..........................................................................................................

95

Chapter 39: HTML Event Attributes

...................................................................................................................

96

Section 39.1: HTML Form Events

Section 39.2: Keyboard Events

Chapter 40: Character Entities

................................................................................................................................

..................................................................................................................................

...........................................................................................................................

97

Section 40.1: Character Entities in HTML

Section 40.2: Common Special Characters

...................................................................................................................

97

..............................................................................................................

97

Chapter 41: ARIA

.........................................................................................................................................................

98

Section 41.1: role="presentation"

Section 41.2: role="alert"

Section 41.3: role="alertdialog"

................................................................................................................................

98

.............................................................................................................................................

...................................................................................................................................

79

79

79

79

85

85

85

86

86

87

88

88

89

90

90

91

91

93

93

96

96

98

98

Section 41.4: role="application"

Section 41.5: role="article"

Section 41.6: role="banner"

Section 41.7: role="button"

Section 41.8: role="cell"

Section 41.9: role="checkbox"

Section 41.10: role="columnheader"

Section 41.11: role="combobox"

Section 41.12: role="complementary"

Section 41.13: role="contentinfo"

Section 41.14: role="definition"

Section 41.15: role="dialog"

Section 41.16: role="directory"

Section 41.17: role="document"

Section 41.18: role="form"

Section 41.19: role="grid"

Section 41.20: role="gridcell"

Section 41.21: role="group"

Section 41.22: role="heading"

Section 41.23: role="img"

Section 41.24: role="link"

Section 41.25: role="list"

Section 41.26: role="listbox"

Section 41.27: role="listitem"

Section 41.28: role="log"

Section 41.29: role="main"

Section 41.30: role="marquee"

Section 41.31: role="math"

Section 41.32: role="menu"

Section 41.33: role="menubar"

Section 41.34: role="menuitem"

Section 41.35: role="menuitemcheckbox"

Section 41.36: role="menuitemradio"

Section 41.37: role="navigation"

Section 41.38: role="note"

Section 41.39: role="option"

Section 41.40: role="progressbar"

Section 41.41: role="radio"

Section 41.42: role="region"

Section 41.43: role="radiogroup"

Section 41.44: role="row"

Section 41.45: role="rowgroup"

Section 41.46: role="rowheader"

Section 41.47: role="scrollbar"

Section 41.48: role="search"

Section 41.49: role="searchbox"

Section 41.50: role="separator"

Section 41.51: role="slider"

Section 41.52: role="spinbutton"

Section 41.53: role="status"

Section 41.54: role="switch"

..................................................................................................................................

...........................................................................................................................................

.........................................................................................................................................

..........................................................................................................................................

................................................................................................................................................

.....................................................................................................................................

.........................................................................................................................

................................................................................................................................

......................................................................................................................

..............................................................................................................................

...........................................................................................................................