+ All Categories
Home > Documents > HTML Text Tables 1 Lecture HTML: Text and Tables.

HTML Text Tables 1 Lecture HTML: Text and Tables.

Date post: 21-Dec-2015
Category:
View: 238 times
Download: 1 times
Share this document with a friend
28
1 HTML Text Tables Lecture HTML: Text and Tables
Transcript
Page 1: HTML Text Tables 1 Lecture HTML: Text and Tables.

1HTML Text Tables

Lecture

HTML: Text and Tables

Page 2: HTML Text Tables 1 Lecture HTML: Text and Tables.

2HTML Text Tables

Structured Text

<P>The nine planets of the solar system are <SAMP>mercury, venus, earth, mars, jupiter, saturn, uranus, neptune and pluto.<SAMP></P>

<P><I>Galileo</I> discovered moons of jupiter and saturn.</P>

As <CITE>Galileo</CITE> once said, <I>The milky way is not a gas, but a mass of stars so numerous as to be beyond belief.</I>

For more information examine <CITE>[World Book Encyc 99]</CITE>.

To order this book, please refer to the following reference number: <STRONG>ISBN 0-7166-0081-1</STRONG>

Page 3: HTML Text Tables 1 Lecture HTML: Text and Tables.

3HTML Text Tables

Browser Output

Page 4: HTML Text Tables 1 Lecture HTML: Text and Tables.

4HTML Text Tables

Phrase Elements

• Phrase elements let the browser determine the presentation style

• EM: Indicates emphasis. • STRONG: Indicates stronger emphasis. • CITE: Contains a citation or a reference to other sources.

Page 5: HTML Text Tables 1 Lecture HTML: Text and Tables.

5HTML Text Tables

Paragraphs

• The paragraph indicator <P> – Usually attached at the end of the paragraph– Causes a new line and whitespace to be generated

• Pairs of paragraph indicators can also be used:

<P> This is the start of a paragraph

containing a single sentence that makes

use of three lines. </P>• there is an alignment attribute, but setting

alignment via the style attribute is preferred

<P ALIGN=left, center, right, justify>

Page 6: HTML Text Tables 1 Lecture HTML: Text and Tables.

6HTML Text Tables

Example - Paragraph and Alignment

<html><head><title>Example of Paragraph tag</title>

</head> <body>

<P align=left>

Callisto is the outermost of Jupiter’s four planet-sized moons and is dominated by impact craters. Despite this, a few more interesting features are also visible.

<P align=center>

Among the most interesting features on Callisto are impact scars from tidally disrupted comets. Callisto is nearly as large as the planet Mercury.

<P align=right>

This indicates that the interior is approximately half water ice as well.

</body></html>

Page 7: HTML Text Tables 1 Lecture HTML: Text and Tables.

7HTML Text Tables

Browser Output - Paragraph Alignment

Page 8: HTML Text Tables 1 Lecture HTML: Text and Tables.

8HTML Text Tables

Lists• There are five kinds of lists: definition,

directory, menu, ordered, and unordered• All lists follow the same pattern:

– <start tag of list>– <list item tag>– <list item tag>– <list item tag>– </ end tag of list>

• directory and menu lists are deprecated

Page 9: HTML Text Tables 1 Lecture HTML: Text and Tables.

9HTML Text Tables

Definition Lists

<DL>

<DT>light year<DD>the distance light travels in one year

<DT>asteroids<DD>are small, irregular shaped objects, mostly occurring between Mars and Jupiter

</DL>

Page 10: HTML Text Tables 1 Lecture HTML: Text and Tables.

10HTML Text Tables

Example - Unordered Lists

<HTML><HEAD><TITLE>Example of Unordered Lists</TITLE></HEAD><BODY><H1>planets and moons</H1><UL><LI>Mars <UL><LI> deimos

<UL> <LI>orbit: 23,459 km from Mars<LI>diameter: 12.6 km<LI>mass: 1.8e15 kg

</UL> <LI>phobos </UL><LI>Jupiter<UL><LI>callisto<LI>europa<LI>ganymede<LI>io</UL></UL></BODY></HTML>

Page 11: HTML Text Tables 1 Lecture HTML: Text and Tables.

11HTML Text Tables

Browser Output of Unordered Lists

Page 12: HTML Text Tables 1 Lecture HTML: Text and Tables.

12HTML Text Tables

Ordered Lists

• Has the general form

<OL><LI> first list item<LI> second list item</OL>• START attribute can initialize the sequence to a

number other than 1• TYPE attribute can be used to select the

numbering style

Type Name Style

1 arabic 1, 2, 3, ...

a lower alpha a, b, c, ...

A upper alpha A, B, C, ...

i lower roman i, ii, iii

I upper roman I, II, III,

Page 13: HTML Text Tables 1 Lecture HTML: Text and Tables.

13HTML Text Tables

Example - Ordered Lists<HTML><HEAD><TITLE>

Example of Ordered Lists</TITLE></HEAD>

<BODY><H1>Planets and Moons as Ordered Lists</H1>

<OL START=4>

<LI>Mars

<OL type=A><LI>deimos

<OL type=I><LI>orbit: 23,459 km from Mars

<LI>diameter: 12.6 km

<LI>mass: 1.8e15 kg

</OL>

<LI>phobos

</OL>

<LI>Jupiter

<OL type=A><LI>callisto<LI>europa<LI>ganymede

<LI>io</OL></OL></BODY></HTML>

Page 14: HTML Text Tables 1 Lecture HTML: Text and Tables.

14HTML Text Tables

Browser Output

Page 15: HTML Text Tables 1 Lecture HTML: Text and Tables.

15HTML Text Tables

Table Elements

• <TABLE>, a tag used to define a table• <CAPTION>, a tag to label a table

– Its attributes are ALIGN = top, bottom, left, right

• <TH></TH> or <TD></TD>, tags that identify a table header cell and table data cell– Headers are the same as data except they use bold font and are centered

• <TR>, a tag that identifies a container for a row of table cells– Same attributes as TH and TD

Page 16: HTML Text Tables 1 Lecture HTML: Text and Tables.

16HTML Text Tables

Facts about Tables• Table data can be text, lists, images, forms,

figures, or even tables• Table headers are typically rendered in

boldface, and table data is typically rendered in the regular font and point size

• A table has an optional caption followed by rows

• Table rows are said to contain table headers and table data

• The browser will set the number of columns to be the greatest number of columns in all of the rows

• Blank cells are used to fill extra columns in the rows

Page 17: HTML Text Tables 1 Lecture HTML: Text and Tables.

17HTML Text Tables

Example - 3 rows x 2 cols

<HTML>

<HEAD>

<TITLE>Table: 3 rows 2 Cols</TITLE>

</HEAD>

<BODY>

<H1>Table: 3 Rows 2 Cols</H1>

<TABLE BORDER>

<CAPTION>MIME Content-Types</CAPTION>

<TR><TD>application/postscript</TD><TD>Postscript</TD>

<TR><TD>application/rtf</TD><TD>MS Rich Text Format</TD>

<TR><TD>application/x-pdf</TD><TD>Adobe Acrobat Format</TD>

</TABLE></BODY></HTML>

Page 18: HTML Text Tables 1 Lecture HTML: Text and Tables.

18HTML Text Tables

Browser Output

Page 19: HTML Text Tables 1 Lecture HTML: Text and Tables.

19HTML Text Tables

Table Example Rowspan colspan

<HTML><HEAD>

<TITLE>Table: Rowspan and Colspan</TITLE>

</HEAD>

<BODY>

<H1>Table: RowSpan and ColSpan</H1>

<TABLE BORDER>

<CAPTION>MIME Content-Types</CAPTION>

<TR><TH ROWSPAN=4>Items</TH><TH colspan=2>Types and Their Meaning</TH>

<TR><TD>application/postscript</TD><TD>Postscript</TD>

<TR><TD>application/rtf</TD><TD>MS Rich Text Format</TD>

<TR><TD>application/x-pdf</TD><TD>Adobe Acrobat Format</TD>

</TABLE></BODY></HTML>

Page 20: HTML Text Tables 1 Lecture HTML: Text and Tables.

20HTML Text Tables

Browser Output

Page 21: HTML Text Tables 1 Lecture HTML: Text and Tables.

21HTML Text Tables

Example - Cell Alignment<HTML><HEAD>

<TITLE>Table: Aligning Cell Data</TITLE>

</HEAD><BODY>

<H1>Table: Aligning Cell Data</H1>

<TABLE BORDER>

<CAPTION>MIME Content-Types</CAPTION>

<TR><TH ROWSPAN=4 valign=top>Items</TH><TH colspan=2>Types and Their Meaning</TH>

<TR><TD>application/postscript</TD><TD align=right>Postscript</TD>

<TR><TD align=center>application/rtf</TD><TD>MS Rich Text Format</TD>

<TR><TD align=right>application/x-pdf</TD><TD>Adobe Acrobat Format</TD>

</TABLE></BODY></HTML>

Page 22: HTML Text Tables 1 Lecture HTML: Text and Tables.

22HTML Text Tables

Browser Output - Cell Alignment

Page 23: HTML Text Tables 1 Lecture HTML: Text and Tables.

23HTML Text Tables

Example cell padding and spacing

<HTML><HEAD>

<TITLE>Table: Cell Padding and Spacing</TITLE>

</HEAD><BODY>

<H1>Table: Cell Padding and Spacing</H1>

<TABLE CELLPADDING=5 CELLSPACING=20 BORDER>

<CAPTION>MIME Content-Types</CAPTION>

<TR><TH ROWSPAN=4 valign=top>Items</TH><TH colspan=2>Types and Their Meaning</TH>

<TR><TD>application/postscript</TD><TD align=right>Postscript</TD>

<TR><TD align=center>application/rtf</TD><TD>MS Rich Text Format</TD>

<TR><TD align=right>application/x-pdf</TD><TD>Adobe Acrobat Format</TD>

</TABLE></BODY></HTML>

Page 24: HTML Text Tables 1 Lecture HTML: Text and Tables.

24HTML Text Tables

Browser Output- cell padding and spacing

Page 25: HTML Text Tables 1 Lecture HTML: Text and Tables.

25HTML Text Tables

Table Example: Surprise Quiz<HTML><HEAD><TITLE>Table: Pop Quiz</TITLE>

</HEAD><BODY><H1>Table: Pop Quiz</H1>

<H2>Draw the table described here</H2>

<TABLE BORDER>

<TR><TD>Datal</TD><TD rowspan=2>Data2</TD>

<TD>Data3</TD>

<TR><TD>Data4</TD><TD>Data5</TD></TABLE>

<H2>Draw the table described here</H2>

<TABLE BORDER>

<TR><TH Rowspan=2 colspan=2></TH>

<TH colspan=2>Average</TH>

<TR><TH>Cost</TH><TH>Time</TH>

<TR><TH Rowspan=2>Projects</TH>

<TH>P1</TH><TD>100</TD><TD>7</TD>

<TR><TH>P2</TH><TD>250</TD><TD>15</TD>

</TABLE></BODY></HTML>

Page 26: HTML Text Tables 1 Lecture HTML: Text and Tables.

26HTML Text Tables

Character references• Character references in HTML may appear in two

forms:– Numeric character references (either decimal or hexadecimal)• &#229; (in decimal) represents the letter "a" with a small circle above it (used, for example, in Norwegian).

• &#60; represents left angle bracket• &#62; represents right angle bracket• &#38; represents ampersand sign• &#34; represents double quote

– Character entity references. • "&lt;" represents the < sign. • "&gt;" represents the > sign. • "&amp;" represents the & sign. • "&quot; represents the " mark.

Page 27: HTML Text Tables 1 Lecture HTML: Text and Tables.

27HTML Text Tables

Example - character references

<HTML><HEAD><TITLE>Example of Character References</TITLE></HEAD>

<BODY>

An unordered list in HTML starts with &lt;UL&gt;, ends with &#60;/UL&#62; and every list item should begin with &lt;LI&gt;. The &lt;/LI&gt; is optional. For an attribute such as START="5&#34; the double quotes are optional.

</BODY></HTML>

Page 28: HTML Text Tables 1 Lecture HTML: Text and Tables.

28HTML Text Tables

Browser Output of Character References


Recommended