History. HTML (HyperText Markup Language) The tags. HTML documents. The browsers. The attributes. A.Lioy - Politecnico di Torino ( ) E-1

Similar documents
HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

The [HTML] Element p. 61 The [HEAD] Element p. 62 The [TITLE] Element p. 63 The [BODY] Element p. 66 HTML Elements p. 66 Core Attributes p.

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

Index. CSS directive, # (octothorpe), intrapage links, 26

A HTML document has two sections 1) HEAD section and 2) BODY section A HTML file is saved with.html or.htm extension

Certified HTML Designer VS-1027

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1

INFS 2150 / 7150 Intro to Web Development / HTML Programming

CSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0

Certified HTML5 Developer VS-1029

COPYRIGHTED MATERIAL. Contents. Introduction. Chapter 1: Structuring Documents for the Web 1

Internet publishing HTML (XHTML) language. Petr Zámostný room: A-72a phone.:

Oliver Pott HTML XML. new reference. Markt+Technik Verlag

Chapter 2:- Introduction to XHTML. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Advanced Web Programming C2. Basic Web Technologies

Fundamentals: Client/Server

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

Html basics Course Outline

Wireframe :: tistory wireframe tistory.

Deccansoft Software Services

As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

UNIT II Dynamic HTML and web designing

Chapter 3 Style Sheets: CSS

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

Learning Objectives. Review html Learn to write a basic webpage in html Understand what the basic building blocks of html are

CSS for Styling CS380

CSS: The Basics CISC 282 September 20, 2014

CSC 121 Computers and Scientific Thinking

Announcements. Paper due this Wednesday

introduction to XHTML

Cascading Style Sheet Quick Reference

HTML: Parsing Library

Web Development & Design Foundations with XHTML. Chapter 2 Key Concepts

Chapter 1 Self Test. LATIHAN BAB 1. tjetjeprb{at}gmail{dot}com. webdesign/favorites.html :// / / / that houses that information. structure?

A Balanced Introduction to Computer Science, 3/E

HTML and CSS COURSE SYLLABUS

CSS. Lecture 16 COMPSCI 111/111G SS 2018

Tables & Lists. Organized Data. R. Scott Granneman. Jans Carton

ROLE OF WEB BROWSING LAYOUT ENGINE EVALUATION IN DEVELOPMENT

HTML TUTORIAL ONE. Understanding What XHTML is Not

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

Intro to html. --- define every element, attribute, and entity along with the rules for their use

A Brief Introduction to HTML

Reading 2.2 Cascading Style Sheets

WML2.0 TUTORIAL. The XHTML Basic defined by the W3C is a proper subset of XHTML, which is a reformulation of HTML in XML.

CSC 443: Web Programming

1.264 Lecture 12. HTML Introduction to FrontPage

CSC Web Programming. Introduction to HTML

CSS Lecture 16 COMPSCI 111/111G SS 2018

@namespace url( /* set default namespace to HTML */ /* bidi */

HTML-5.com itemscopehttp://data-vocabulary.org/breadcrumb<span itemprop="title">html 5</span> itemscopehttp://data-vocabulary.

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

Chapter 4. Introduction to XHTML: Part 1

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

QUICK REFERENCE GUIDE

Basic Web Pages with XHTML (and a bit of CSS) CSE 190 M (Web Programming), Spring 2008 University of Washington Reading: Chapter 1, sections

Appendix D CSS Properties and Values

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

HTML BEGINNING TAGS. HTML Structure <html> <head> <title> </title> </head> <body> Web page content </body> </html>

COMSC-030 Web Site Development- Part 1. Part-Time Instructor: Joenil Mistal

</HTML> </HEAD> </BODY> </TITLE> </I> </B> </U> </BLINK> </EM> </FONT> </FONT> </CENTER> </H1> </H2> </H3> </P> </BR> --!>

HTML: Parsing Library

CS144 Notes: Web Standards

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

Web Publishing Basics I

Summary 4/5. (contains info about the html)

Basics of Web Design, 3 rd Edition Instructor Materials Chapter 2 Test Bank

HYPERTEXT MARKUP LANGUAGE ( HTML )

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

Tutorial 2 - HTML basics

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

2.1 Origins and Evolution of HTML

Hyper Text Markup Language HTML: A Tutorial

INTRODUCTION TO HTML5! HTML5 Page Structure!

Name Related Elements Type Default Depr. DTD Comment

Beginning Web Programming with HTML, XHTML, and CSS. Second Edition. Jon Duckett

Indian Institute of Technology Kharagpur. HTML Part III. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T.

Advanced HTML Scripting WebGUI Users Conference

Web Development & Design Foundations with HTML5 & CSS3 Instructor Materials Chapter 2 Test Bank

HTML/XML. HTML Continued Introduction to CSS

Outline. Link HTML With Style Sheets &6&7XWRULDO &66 ;+70/ (GZDUG;LD

Introducing Web Tables

Chapter 5. Introduction to XHTML: Part 2

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

Part 1: HTML Language HyperText Make-up Language

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 2 Introduction to XHTML

2.1 Origins and Evolution of HTML. 2.3 HTML Document Structure

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Chapter 4 Notes. Creating Tables in a Website

HTML & XHTML Tag Quick Reference

Programmazione Web a.a. 2017/2018 HTML5

CSS. (Cascading Style Sheets) HTML (Hyper Text Markup Language) HTML: styles. 07/07/2011(mar'09) A.Lioy - Politecnico di Torino ( ) F.

Table-Based Web Pages

ICT IGCSE Practical Revision Presentation Web Authoring

Symbols INDEX. !important rule, rule, , 146, , rule,

Shatin Tsung Tsin Secondary School S.3 Computer and Technology Web Page Design by HTML Introduction to HTML

HTML (Hyper Text Markup Language) CSS. (Cascading Style Sheets) HTML: problems with styles. HTML: styles. CSS: specifications.

Basic HTML. Lecture 14. Robb T. Koether. Hampden-Sydney College. Wed, Feb 20, 2013

Transcription:

HTML (HyperText Markup Language) Antonio Lioy < lioy@polito.it it > english version created by Marco D. Aime < m.aime@polito.it > Politecnico di Torino Dip. Automatica e Informatica History HTML 2.0 (nov 95 = RFC-1886) specifies the de-facto standard of 1994 HTML 3.2 (1996) compatible with 2.0 adds tables, applets, superscripts, subscripts, text surrounding images, HTML 4.01 (dec 97 apr 98 dec 99) last (?) version of HTML XHMTL 1.0 (jan 00 aug 02) rewriting of HTML 4.01 with XML strict / transitional / frameset HTML documents are normal US-ASCII texts therefore, letters with accents or other extended characters are not allowed... enriched with hypertext and hypermedia links... and with limited text formatting capabilities all these additional capabilities are achieved through annotations expressed with tags The tags enclosed between the symbols less than" and greater than" usually they are paired (start tag end tag) <h1>... </h1> but can also be standalone <br> ( <br /> in XHTML) general rule: the final tag is the same of the initial one, preceded by the symbol / they are case insensitive in HTML and lowercase in XHTML therefore it is better to write them always lowercase The attributes you can better characterise a tag by using a set of attributes every attribute consists in a variable with an assigned value, placed inside the opening tag (e.g. <hr width="90%">) The browsers visualising HTML documents (and navigate them) requires an appropriate program: an HTML browser a browser is an interpreter: reads the source code (HTML + extensions) tries to understand it (hoping there are no errors ) does its best to visualise what is described by the source code attention! not every browser visualises a given document in the same way textual browser: Lynx graphical browsers: Firefox, SeaMonkey, Netscape, Opera, Internet Explorer,... A.Lioy - Politecnico di Torino (2009-2010) E-1

The war of the browsers there is not a single browser much more diffused than the others (personal preferences, platform, ) you must try to write HTML pages that fit every browser some statistics: www.w3schools.com/browsers/browsers_stats.asp (jan-10) IE8=14%, IE7=12%, IE6=10%, FX=46%, Chrome=11%, Safari=4%, Opera=2% www.upsdell.com/browsernews/stat.htm high variability www.pgts.com.au/pgtsj/pgtsj0212d.html difficult to identify various browsers with certainty General structure of HTML documents <!DOCTYPE HTML PUBLIC...> <head> <title> title </title>... other headers... </head> <body> text of the document </body> Document type declaration (DTD) required to identify the type of HTML (from 4.01): strict.dtd = all non-deprecated elements loose.dtd = includes deprecated elements frameset.dtd = loose + use of frames <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN "http://www.w3.org/tr/html4/strict.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/tr/html4/frameset.dtd"> Example <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <head> <title>example of HTML page</title> </head> <body> Here I can insert my document s text, which will be visualised as simple text if I don t use any formatting tag. </body> Notes browsers do not signal errors: they ignore them! white spaces and end of lines: multiple spaces are treated as a single space end-of-lines has no effect on the formatting the title (and in general the data inside the head) is very important since it is the element most used by automatic indexing services HTML is an extensible language often new tags are added browsers ignore unrecognised tags (or attributes) but visualise the text enclosed inside the tag Meta-data inside the HEAD part data useful for: indexing the HTML page providing information to the web server and / or to the browser syntax: <meta name="author" content="antonio Lioy"> <meta name="keywords" content="html"> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta http-equiv="expires" content="sun, 28 Feb 2010 23:59:00 GMT"> A.Lioy - Politecnico di Torino (2009-2010) E-2

HTML internationalization HTML < 4 written with the ISO-8859-1 encoding HTML-4 incorporates RFC-2070 that deals with internationalization (i18n in brief) of HTML adoption of the ISO/IEC:10646 standard as the document character set user agebts determine the character encoding according to (from highest to lowest priority): HTTP response header "Content-Type: charset=xxx" proper META tag in the HTML header <meta http-equiv="content-type" charset=xxx" > charset attribute of an element that designates an external resource The link tag inside the HEAD part logical connection to documents somehow related to the current one multiple LINK tags are possible attributes: href=url rel=alternate lang= rel=alternate media= rel=stylesheet rel=start / contents / prev / next / type=mime-type Example of LINK <head> <title>chapter 2</title> <link rel="contents" href="../toc.html"> <link rel="next" href="chapter3.html"> <link rel="prev" href="chapter1.html"> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> Tools for checking HTML http://validator.w3.org allows verifying if a page fully satisfies the official syntax can provide detailed explanations on the errors and on how to correct them http://tidy.sourceforge.net cleans the HTML code and transforms it to more recent versions can be installed locally or used through the network http://cgi.w3.org/cgi-bin/tidy problems with dynamically generated HTML (cannot validate an ASP or PHP source page) Tools for checking HTML validation of dynamic pages must be performed on the client rather than on the server therefore, you need: a special plugin for the browser manually visit all the pages to be validated an excellent plugin for FireFox: http://users.skynet.be/mgueury/mozilla/index.html configured in "SGML parser" mode to have the same results of validator.w3.org Comments can be inserted at every point in the text can span multiple lines enclosed inside <!-- and --> examples: <! - this is a comment --> <!-- this comment spans four lines --> A.Lioy - Politecnico di Torino (2009-2010) E-3

Headings there are six levels of headings or titles: <h1>... </h1> <h2>... </h2> <h3>... </h3> <h4>...</h4>.. <h5>... </h5> <h6>... </h6> should be used according to the logical meaning (semantics), not to achieve a specific formatting in particular, it is not correct to use <hn> if not preceded by <hn-1> Text blocks <p>... </p> starts and terminates a paragraph after terminating a paragraph, browsers break the current line (and may also insert a small vertical space) <br> (HTML) <br/> (XHTML) inserts a line break <hr> (HTML) <hr/> (XHTML) inserts an horizontal rule (line) Horizontal rules (tag <HR>) (*) can specify the following attributes: size= n_pixel (height) width= n_pixel (absolute width) width= percentuale (width as % of the container) align=left left / right / center by default the line is centered and has a width of 100% attention!: HTML presentational attributes have been deprecated since style sheets exist (e.g. CSS) unordered list: <ul>... </ul> ordered list: <ol>... </ol> directory (deprecated): <dir>... </dir> Lists menu (deprecated): <menu>... </menu> an element of (any) list: <li>... </li> Options for lists symbol preceding the items in unordered lists: type=disc / circle / square numbering style in ordered lists: start= index_of_the_first_item type=a / a / I / i / 1 that is: alphabetic list (uppercase or lowercase) roman numbers (uppercase or lowercase) decimal numbers can be specified for the whole list (ol) and for the single element (li) List example To pass the exam: <ol type="i"> <li>attend the lessons</li> <li>perform the lab exercises</li> </ol> browser (note the indentation) To pass the exam: I. attend the lessons II. perform the lab exercises A.Lioy - Politecnico di Torino (2009-2010) E-4

definition lists: Definitions <dl> <dt> term 1 </dt> <dd> definition 1... </dd> <dt> term 2 </dt> <dd> definition 2... </dd>..... </dl> Text formatting a text block can be characterised based on the role it plays in the document (logical style)...... or based on the way we want to visualise it physically (physical style) best to prefer logical styles and to leave greater freedom to the final user in defining how the text should appear on the screen with XHTML (strict), the formatting tags have finally disappeared (you need to use CSS) Formatting: physical styles <b>... </b> bold text <i>... </i> italic text <u>... </u> underlined text <tt>... </tt> monospace text (like typewriter) <blink>... </blink> blinking text Formatting: physical styles <sup>... </sup> superscript text <sub>... </sub> subscript text <s>... </s> <strike>... </strike> strikethrough text Formatting: logical styles <cite> citation </cite > <code> code (program) </code> <em> emphasis </em> <kbd> keyboard </kbd> <samp> example </samp> <strong> reinforcement </strong> <var> variable </var> <dfn> definition </dfn> Other logical styles <big> big text </big> <small> small text </small> can be nested to achieve an increased effect: <big> <big> very big text </big> </big> A.Lioy - Politecnico di Torino (2009-2010) E-5

Formatting: text blocks <address>... </address> address (typically e-mail) <blockquote>... </blockquote> long citations <center>... </center> centered text <pre>... </pre> preformatted text (spacing is preserved) Reference to non US-ASCII characters HTML normally written in US-ASCII with MSB=0 ASCII characters > 127 must be encoded, as also characters with special meaning pay attention to the final ";" to have... write... < < > > & & " " È È é é important since these are HTML reserved characters Reference to non US-ASCII characters section 24 (pg. 299) in the HTML 4.01 standard includes: ISO 8859-1 extended characters e.g.» =» mathematical symbols e.g. = Greek letters e.g. α = α international symbols e.g. = Links ( hyperlinks ) by using hyperlinks you can move automatically from a resource to another the HTML tag identifying the presence of a link is named anchor, and is identified with <a> Hot to insert an hyperlink open the anchor opening tag: <a insert a space insert the URL of the resource, preceded by href= and enclosed by apices close the opening tag with > insert the text to highlight (the one associated with the anchor, called "hot word") close the anchor: </a> <a href="http://www.polito.it">polito</a> Absolute and relative links it is possible to omit parts of the URL in this case, it is called a relative link the missing parts assume the same value of the current page examples of relative links (supposed to be placed inside the page http://www.lioy.it/01eny/exam.html) relative link biblio.html../cv.html res/a1.html absolute link http://www.lioy.it/01eny/biblio.html http://www.lioy.it/cv.html http://www.lioy.it/01eny/res/a1.html A.Lioy - Politecnico di Torino (2009-2010) E-6

Document access points Link without specification of an access point Title doc01 Address Title Address Title doc02 Address Document access points in the target document, define the access point through an anchor with the attribute NAME <a name="cuc_ita"> La cucina italiana </a> in the origin document, include the name of the access point in the URL <a href="doc2.html#cuc_ita"> the access point can also be any element identified through its "id" <h1 id="cuc_ita"> La cucina italiana </h1> Images <img src="polito.gif"> inserts the image contained in the file polito.gif <img src="polito.gif" alt= Picture of Politecnico"> inserts the image polito.gif, but, if the browser does not support graphics, it visualises the text Picture of Politecnico difference between linking and inserting an image: <img src="polito.gif"> (inserts the image inside the page) <a href="polito.gif"> (by following the link, you visit a page containing only the image) Reciprocal positioning of text and images <img align=left...> <img align=right...> <img align=top...> <img align=center...> <img align=texttop...> <img align=middle...> <img align=absmiddle...> <img align=baseline...> <img align=bottom...> <img align=absbottom...> Image formatting <img width=w height=h... > image size allows rapid visualisation of the page (the browser does not need to download the image before knowing how much space should be reserved to it) <img vspace=v hspace=h... > minimum distance between text and the image <img border=b... > size of the border Font <font... >... </font> font for the text block included within the tags deprecated (use CSS) attributes: size= size color= color face= font-family the size can be specified in various units: N (=1 7, default=3), +N, N suggested +N N A.Lioy - Politecnico di Torino (2009-2010) E-7

Colors some predefined colors are accessible by name: Black, White, Gray, Silver, Yellow, Red, Purple, Fuchsia, Maroon, Green, Lime, Olive, Aqua, Teal, Blue, Navy other colors can be specified through their RGB hexadecimal code ( # rr gg bb ) example: <font color="#ffffff">white!</font> Standard colors black = #000000 green = #008000 silver = #C0C0C0 lime = #00FF00 gray = #808080 olive = #808000 white = #FFFFFF yellow = #FFFF00 maroon = #800000 navy = #000080 red = #FF0000 blue = #0000FF purple = #800080 fuchsia = #FF00FF teal = #008080 aqua = #00FFFF <table... >... </table> attributes: Tables align= left / center / right border= size width= size (n_pixel or %) cellspacing= size cellpadding= size summary= text frame= void / above / below / hsides / lhs / rhs / vsides / box / border rules = none / groups / rows / cols / all <tr... >... </tr> a row of the table Table data contains normal (<td>) or heading (<th>) cells <th... >... </th> <td... >... </td> table data (or heading), which can span multiple cells, horizontally or vertically colspan= number-of-columns rowspan= number-of-rows <thead> heading <tbody> Optional elements of a table content block <tfoot> footer <caption> caption text describing the nature of the table Table: row, header, and data attributes align= horizontal-alignment left, center, right valign= vertical-alignment top, middle, bottom baseline bgcolor= color A.Lioy - Politecnico di Torino (2009-2010) E-8

Table: column groups <colgroup span=n width= align= valign= > structural group of n columns, everyone with the specified attributes <col span=n width= align= valign= > definition of attributes for one or more columns Frames division of a page in zones whose content is specified by other HTML files deprecated (use CSS and include ) <head>... </head> <frameset...> <frame...> <frame...> <frame...> </frameset...>......... Frameset and Frame the structure of a page organised in frames is similar to the traditional one, replacing <body> with <frameset> it is possible to nest the FrameSet tags to create complex page subdivisions the content of every frame is specified through: <frame src=uri name=...> use the <noframe> tag for the text to be visualised by browsers not supporting frames Space spanned by frames it is possible to specify the portion of the page occupied by each frame, by using: percentage (of the available space) absolute value (in pixel) "*" to use all the remaining space in case of overflow the scrollbars (H & V) are activated example (subdivision in 3 horizontal frames): <frameset rows= 20%,50%,30% > examples (vertical subdivision): < frameset cols= 20%,80% > < frameset cols= 100,*,100 > Frame navigation links should indicate into which frame (or window) the target page should be visualised: <a href=uri target="name_of_a_frame"> </a> special values for target: "_blank" (new window) "_self" (in the same frame) = default "_parent" (higher order frameset) "_top" (span the entire window) Frame example (I) <! initial page --> <frameset rows="80%,20%"> <noframe> <p>the page cannot be shown</p> </noframe> <frameset cols="100,*"> <frame src="menu.html"> <frame src="p1.html" name="content"> </frameset> <frame src="footer.html"> </frameset> A.Lioy - Politecnico di Torino (2009-2010) E-9

Frame example (II) <!-- menu.html --> <head>... </head> <body> <p><a href="p1.html" target="content">pag.1</a></p> <p><a href="p2 p2.html html" target="content">pag >Pag.2</a></p> <p><a href="p3.html" target="content">pag.3</a></p> </body> Inline frame (iframe) a frame handled as a single object (e.g. as an image) therefore, it can be placed at any point in the page initially supported only by IE syntax: <iframe src=uri >... </iframe> height= width= name= frameborder= marginwidth= marginheight= scrolling=yes/no/auto align= vspace= hspace= the text inside the tag is ignored by browsers supporting iframe, and visualised by the others (use it for error signalling) DIV and SPAN introduced in HTML 4.0 to group parts and apply formatting more easily DIV identifies a block (typically, browsers place a line break before and after a block) SPAN identifies a part inside a block frequently used to create (with an appropriate CSS) a page layout without using tables or frames id and class allow references from the CSS <div id="..." class="...">... </div> <span id="..." class="...">... </span> General attributes of HTML tags id = "string" anchor for a link reference to an element from a script reference to a field in a form reference for a specific style in CSS class = "class1 class2 " list of classes to be used e.g. as CSS selectors title = "title" visualised when pointing to the element lang = "language" for automatic text reading (values: en it fr de ) Favourite icon the little icon near the URL a 16 x 16 pixel image old browsers: only in MS icon format in a fixed position and with fixed name = /favicon.ico first step to standardization: <link rel="shortcut icon" href="/icons/my.ico" type="image/vnd.microsoft.icon"> new browsers support the de-facto standard: <link rel="icon" type="image/png" href="/icons/my.png"> A.Lioy - Politecnico di Torino (2009-2010) E-10