PROGETTAZIONE E MANAGEMENT DEL MULTIMEDIA PER LA COMUNICAZIONE XVIII - - PowerPoint PPT Presentation

progettazione e management del multimedia per la
SMART_READER_LITE
LIVE PREVIEW

PROGETTAZIONE E MANAGEMENT DEL MULTIMEDIA PER LA COMUNICAZIONE XVIII - - PowerPoint PPT Presentation

PROGETTAZIONE E MANAGEMENT DEL MULTIMEDIA PER LA COMUNICAZIONE XVIII EDIZIONE 2014/2015 LINGUAGGI DI MARKUP HTML cristina gena dipartimento di informatica cgena@di.unito.it http://www.di.unito.it/~cgena/ materiale e info sul corso


slide-1
SLIDE 1

PROGETTAZIONE E MANAGEMENT DEL MULTIMEDIA PER LA COMUNICAZIONE XVIII EDIZIONE – 2014/2015 LINGUAGGI DI MARKUP HTML

cristina gena dipartimento di informatica cgena@di.unito.it http://www.di.unito.it/~cgena/ materiale e info sul corso http://www.di.unito.it/~cgena/teaching.html Fonte delle slides http://www.w3schools.com/html/default.asp

slide-2
SLIDE 2

HTML COMMENTS

  • Comment tags <!-- and --> are used to insert comments in HTML.

Example <!-- This is a comment --> <p>This is a paragraph.</p> <!-- Remember to add more information here —>

  • Comments are also great for debugging HTML, because you can comment out HTML lines of code, one at a

time, to search for errors: Example <!-- Do not display this at the moment <img border="0" src="pic_mountain.jpg" alt="Mountain"> —>

2

slide-3
SLIDE 3

HTML COMMENTS

  • Conditional Comments
  • You might stumble upon conditional comments in HTML:

<!--[if IE 8]> .... some HTML here .... <![endif]-->

  • Conditional comments defines HTML tags to be executed by Internet Explorer only.

3

slide-4
SLIDE 4

HTML IMAGES

  • HTML images are defined with the <img> tag.
  • The source file (src), alternative text (alt), and size (width and height) are

provided as attributes: Example <img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

4

slide-5
SLIDE 5

HTML IMAGE ATTRIBUTES

  • The alt attribute specifies an alternate text for the image, if it cannot be displayed.
  • The value of the alt attribute should describe the image in words:

<img src="html5.gif" alt="The official HTML5 Icon">

  • The alt attribute is required. A web page will not validate correctly without it. (http://validator.w3.org)
  • Screen readers are software programs that can read what is displayed on a screen.
  • Used on the web, screen readers can "reproduce" HTML as text-to-speech, sound icons, or braille output.
  • Screen readers are used by people who are blind, visually impaired, or learning disabled.
  • Note: Screen readers can read the alt attribute.

5

slide-6
SLIDE 6

HTML IMAGE ATTRIBUTES

  • Image Size - Width and Height
  • The values are specified in pixels (without px after the value):

<img src="html5.gif" alt="HTML5 Icon" width="128" height=“128">

  • You can also use the style attribute to specify the width and height of an image.
  • The values are specified in pixels (use px after the value):

<img src="html5.gif" alt="HTML5 Icon" style="width:128px;height:128px">

  • Both the width, the height, and the style attributes, are valid in the latest HTML5 standard.
  • We suggest you use the style attribute. It prevents styles sheets from changing the default size of images:

6

slide-7
SLIDE 7

HTML IMAGE STORAGE

  • If not specified, the browser expects to find the image in the same folder as the web page.
  • However, it is common on the web, to store images in a sub-folder, and refer to the folder

in the image name: <img src="images/html5.gif" alt="HTML5 Icon" style="width:128px;height:128px">

  • If a browser cannot find an image, it will display a broken link icon (http://

www.w3schools.com/html/tryit.asp?filename=tryhtml_images_wrong)

  • Some web sites store their images on image servers.
  • Actually, you can access images from any web address in the world:

<img src="http://www.w3schools.com/images/w3schools_green.jpg">

7

slide-8
SLIDE 8

USING AN IMAGE AS A LINK

  • It is common to use images as links:

Example <a href=“http://www.w3schools.com/html/ “> <img src="smiley.gif" alt="HTML tutorial" style="width:42px;height:42px;border:0"> </a>

8

slide-9
SLIDE 9

IMAGE MAPS

  • For an image, you can create an image map, with clickable areas:

Example <img src="planets.gif" alt="Planets" usemap="#planetmap" style="width:145px;height:126px"> <map name="planetmap"> <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm"> <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm"> <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm"> </map> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_images_map

9

slide-10
SLIDE 10

HTML LINKS

HTML links are defined with the <a> tag: Link Syntax: <a href="url">link text</a> Example <a href=“local.php">This is a local link</a> <a href="http://www.w3schools.com/html/">Visit our HTML tutorial</a>

10

slide-11
SLIDE 11

HTML LINKS - COLORS AND ICONS

  • When you move the mouse cursor over a link, two things will normally happen:
  • The mouse arrow will turn into a little hand
  • The color of the link element will change
  • By default, links will appear as this in all browsers:
  • An unvisited link is underlined and blue
  • A visited link is underlined and purple
  • An active link is underlined and red

You can change the defaults, using CSS styles

11

slide-12
SLIDE 12

HTML LINK PATH

Examples <a href=“local.html">This is a local link</a> <a href=“php/local.html”>This is a local link</a> <a href=“../php/local.html”>This is a local link</a>

12

slide-13
SLIDE 13

39

HTML

I PATHNAME <a href=" file:///c:/wwwroot/pagine/pippo.html"> Pathname assoluto Sconsigliato!

slide-14
SLIDE 14

40

HTML

I PATHNAME <a href=“pippo.html“> -> il file è nella stessa cartella della pagina pluto.html

da cui parte il collegamento

Pathname relativi pippo.html pluto.html

slide-15
SLIDE 15

41

HTML

I PATHNAME <a href=“cani/pippo.html“> -> il file pippo.html è nella cartella cani, contenuta a sua volta nella cartella della pagina pluto.html da cui parte il collegamento Pathname relativi pluto.html pippo.html cani

slide-16
SLIDE 16

42

HTML

Pathname relativi pluto.html pippo.html cani I PATHNAME <a href =“../cani/pippo.html“>-> il file pippo.html è nella cartella cani che sta allo stesso livello della cartella che contiene la pagina pluto.html da cui parte il collegamento

slide-17
SLIDE 17

43

HTML

I PATHNAME <a href =“../../cani/pippo.html“>-> il file pippo.html è nella cartella cani che sta ad un livello superiore rispetto alla cartella che contiene la pagina pluto.html da cui parte il collegamento Pathname relativi pluto.html pippo.html cani

slide-18
SLIDE 18

IMAGE PATHS

<img src="html5.gif" alt="HTML5 Icon" style=“width:128px;height: 128px"> <img src=“images/html5.gif” alt="HTML5 Icon" style=“width: 128px;height:128px"> <img src=“../images/html5.gif” alt="HTML5 Icon" style=“width: 128px;height:128px"> <img src="/images/html5.gif" alt="HTML5 Icon" style=“width: 128px;height:128px"> —> MAIN ROOT

slide-19
SLIDE 19

HTML LINKS - THE TARGET ATTRIBUTE

  • The target attribute specifies where to open the linked document.
  • This example will open the linked document in a new browser window
  • r in a new tab:

Example <a href="http://www.w3schools.com/" target="_blank">Visit W3Schools!</a>

19

slide-20
SLIDE 20

HTML LINKS - THE ID ATTRIBUTE

  • The id attribute can be used to create bookmarks inside HTML documents.
  • Bookmarks are not displayed in any special way. They are invisible to the reader.
  • Add an id attribute to any <a> element:

<a id="tips">Useful Tips Section</a>

  • Then create a link to the <a> element (Useful Tips Section):

<a href="#tips">Visit the Useful Tips Section</a>

  • Or, create a link to the <a> element (Useful Tips Section) from another page:

<a href="http://www.w3schools.com/html_links.htm#tips">Visit the Useful Tips Section</a> Example: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_links_bookmark

20

slide-21
SLIDE 21

HTML TABLES

<table style="width:100%"> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>94</td> </tr> </table>

http://www.di.unito.it/~cgena/aim/

slide-22
SLIDE 22

HTML TABLES

  • Tables are defined with the <table> tag.
  • Tables are divided into table rows with the <tr> tag.
  • Table rows are divided into table data with the <td> tag.
  • A table row can also be divided into table headings with the <th> tag.
  • Note: Table data <td> are the data containers of the table.They can

contain all sorts of HTML elements like text, images, lists, other tables, etc.

slide-23
SLIDE 23

AN HTML TABLE WITH A BORDER ATTRIBUTE

<table style=“width:100%; height: 20%” border=“1”> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>94</td> </tr> </table>

NoteThe border attribute is on its way out of the HTML standard! It is better to use CSS. To add borders, use the CSS border property: table, th, td { border: 1px solid black; }

slide-24
SLIDE 24

HTML TABLES

  • An HTML Table with Collapsed Borders
  • If you want the borders to collapse into one border, add

CSS border-collapse:

table, th, td { border: 1px solid black; border-collapse: collapse; }

slide-25
SLIDE 25

CELL PADDING

  • An HTML Table with Cell Padding
  • Cell padding specifies the space between the cell content and its borders.
  • If you do not specify a padding, the table cells will be displayed without padding.
  • To set the padding, use the CSS padding property:

table, th, td { border: 1px solid black; border-collapse: collapse;} th,td { padding: 15px;}

slide-26
SLIDE 26

CELL SPACING

  • Border spacing specifies the space between the cells.
  • To set the border spacing for a table, use the CSS

border-spacing property:

table { border-spacing: 5px; }

slide-27
SLIDE 27

TABLE HEADINGS

  • Table headings are defined with the <th> tag.
  • By default, all major browsers display table headings as bold and centered:

<table style="width:100%"> <tr> <th>Firstname</th> <th>Lastname</th> <th>Points</th> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>94</td> </tr> </table>

slide-28
SLIDE 28

TABLE CELLS THAT SPAN MANY COLUMNS

  • To make a cell span more than one column, use the colspan attribute:

<table style="width:100%"> <tr> <th>Name</th> <th colspan="2">Telephone</th> </tr> <tr> <td>Bill Gates</td> <td>555 77 854</td> <td>555 77 855</td> </tr> </table>

slide-29
SLIDE 29

TABLE CELLS THAT SPAN MANY ROWS

  • To make a cell span more than one row, use the rowspan attribute:

<table style="width:100%"> <tr> <th>First Name:</th> <td>Bill Gates</td> </tr> <tr> <th rowspan="2">Telephone:</th> <td>555 77 854</td> </tr> <tr> <td>555 77 855</td> </tr> </table>

slide-30
SLIDE 30

AN HTML TABLE WITH A CAPTION

  • To add a caption to a table, use the <caption> tag:

caption caption-side: bottom; <table style="width:100%"> <caption>Monthly savings</caption> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$50</td>

slide-31
SLIDE 31

UNORDERED HTML LISTS

  • An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
  • The list items will be marked with bullets (small black circles).
  • Unordered List:

<ul> <li>Apples</li> <li>Bananas</li> <li>Lemons</li> <li>Oranges</li> </ul>

slide-32
SLIDE 32

UNORDERED HTML LISTS - THE STYLE ATTRIBUTE

  • A style attribute can be added to an unordered

list, to define the style of the marker:

  • list-style-type: disc. The list items will be marked with bullets (default)
  • list-style-type: circle. The list items will be marked with circles
  • list-style-type: square. The list items will be marked with squares
  • list-style-type: none
slide-33
SLIDE 33

UNORDERED HTML LISTS - THE STYLE ATTRIBUTE

  • Disc:

<ul style="list-style-type:disc"> <li>Coffee</li> <li>Tea <li>Milk</li> </ul>

  • Circle:

<ul style="list-style-type:circle"> <li>Coffee</li> <li>Tea <li>Milk</li> </ul>

slide-34
SLIDE 34

UNORDERED HTML LISTS - THE STYLE ATTRIBUTE

  • Square:

<ul style="list-style-type:square"> <li>Coffee</li> <li>Tea <li>Milk</li> </ul>

  • None:

<ul style="list-style-type:none"> <li>Coffee</li> <li>Tea <li>Milk</li> </ul>

slide-35
SLIDE 35

ORDERED HTML LISTS

  • An ordered list starts with the <ol> tag.
  • Each list item starts with the <li> tag.
  • The list items will be marked with numbers.
  • Ordered List:

<ol> <li>Apples</li> <li>Bananas</li> <li>Lemons</li> <li>Oranges</li> </ol>

slide-36
SLIDE 36

ORDERED HTML LISTS

  • A type attribute can be added to an ordered list, to define the type
  • f the marker:
  • TypeDescription
  • type="1"

The list items will be numbered with numbers (default)

  • type="A"

The list items will be numbered with uppercase letters

  • type="a"

The list items will be numbered with lowercase letters

  • type="I"

The list items will be numbered with uppercase roman numbers

  • type="i"

The list items will be numbered with lowercase roman numbers

slide-37
SLIDE 37

ORDERED HTML LISTS

  • Upper Case:

<ol type="A"> <li>Coffee</li> <li>Tea <li>Milk</li> </ol>

  • Lower Case:

<ol type="a"> <li>Coffee</li> <li>Tea <li>Milk</li> </ol>

slide-38
SLIDE 38

NESTED HTML LISTS

  • List can be nested (lists inside lists)

<ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul> </li> <li>Milk</li> </ul>

slide-39
SLIDE 39

HORIZONTAL LISTS

  • HTML lists can be styled in many different ways with CSS.
  • One popular way, is to style a list to display horizontally
slide-40
SLIDE 40

New Style:

ul#menu { padding: 0;} ul#menu li { display: inline;} ul#menu li a { background-color: black; color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px 4px 0 0;} ul#menu li a:hover { background-color: orange;}

slide-41
SLIDE 41

HTML DESCRIPTION LISTS

  • A description list, is a list of terms, with a description of each term.
  • The <dl> tag defines a description list.
  • The <dt> tag defines the term (name), and the <dd> tag defines the data (description).
  • Description List:

<dl> <dt>Coffee</dt> <dd>- black hot drink</dd> <dt>Milk</dt> <dd>- white cold drink</dd> </dl>