<<

(Modern) HTML A fast-paced introduction to HTML5

Enrico Masala Fulvio Corno

Applicazioni Web I - Web Applications I - 2019/2020 Goal

• Quick introduction to the essential features of HTML – Document structure and syntax – Essential elements – Semantic elements – Page structuring • Aligned to what HTML 5 looks like in year 2020

2 Applicazioni Web I - Web Applications I - 2019/2020 Rough timeline of web technologies

HTML5 • WHATWG XHTML 1.0 • and W3C • W3C • 2014 HTML 4.01 • 2000 • 1999 • XML-based; HTML 3.2 discontinued • W3C HTML 2.0 • 1997 WHATWG: Web Hypertext • IETF HTML Application Technology • 1995 W3C: World Wide Working Group • CERN Web Consortium • 1991

https://html.spec.whatwg.org/multipage/ https://html.spec.whatwg.org/dev/ 3 Applicazioni Web I - Web Applications I - 2019/2020 A different approach HTML 4.01 HTML 5

web pages web applications

design user interaction

4 Applicazioni Web I - Web Applications I - 2019/2020 HTML 5 is a family of standards

5 Applicazioni Web I - Web Applications I - 2019/2020 Live standard: Browser Compatibility?

• https://caniuse.com/

6 Applicazioni Web I - Web Applications I - 2019/2020 A basic HTML document

• Unicode Text File • DOCTYPE declaration • Nested tree of Elements – Strict nesting • Element: – Start tag: – Attributes: href="demo.html" • Name=value pairs – End tag: – Inner text: simple

7 Applicazioni Web I - Web Applications I - 2019/2020 Mandatory structure

• First line: • root element, contains the whole file – (title, other metadata, load style sheets, load code) – (actual page content)

8 Applicazioni Web I - Web Applications I - 2019/2020 HTML parsing into a DOM tree

Parsing

9 Applicazioni Web I - Web Applications I - 2019/2020 HTML elements

• Elements are used to define the • Each element has a default meaning of a portion of a display value document – display:block – Semantic markup • Full-width • The meaning will be rendered • Starts on a new line • Top-to-bottom layout graphically, according to the style – display:inline sheets • Does not start a new line – No HTML code should deal with • Occupies just the necessary space presentation issues • Left-to-right layout

10 Applicazioni Web I - Web Applications I - 2019/2020 Categories of HTML elements

• Sectioning content defines headings and footers • Heading content defines the header of a section • Phrasing content is the text of the document, as well as elements that mark up that text at the intra- paragraph level. – Runs of phrasing content form paragraphs. • Flow content includes most types of elements https://html.spec.whatwg.org/dev/dom.html#kinds-of-content 11 Applicazioni Web I - Web Applications I - 2019/2020 Sections and Headings (block)

Sectioning content Heading content • article • h1 • aside • h2 • nav • h3 • section • h4 • h5 • h6 • hgroup

12 Applicazioni Web I - Web Applications I - 2019/2020 Usage guide

Element Usage

complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable
A generic section of a document or application. A thematic grouping of content, typically with a heading