06.01.2015 Views

HTML Lecture 1 - La Trobe University

HTML Lecture 1 - La Trobe University

HTML Lecture 1 - La Trobe University

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

The World Wide Web (WWW)<br />

World Wide Web exists because of the Internet. The World Wide Web (WWW) is an Internet based<br />

information sharing system using hypertext and multimedia.<br />

The Internet is an interconnected network of computers that provides many services - email, telnet,<br />

ftp, Newsgroups, Internet Relay Chat, voice communication and others including the World Wide<br />

Web.<br />

The Internet was the result of a USA Department of Defense project from the 1960s that allows<br />

dynamic routing of data communication in a computer network under the conditions of war –<br />

communication transmission paths could be damaged or destroyed so messages need to be routed<br />

via another path.<br />

The World Wide Web project<br />

(1989) Tim Berners-Lee proposed a hypertext information system that would make<br />

documents accessible across the variety of different computer systems being used by<br />

researchers at CERN (the European Organization for Nuclear Research in Switzerland).<br />

(1990) Tim Berners-Lee is credited with writing the first web client (browser) and server.<br />

SGML was available but was considered too powerful and complex for the task. <strong>HTML</strong> was<br />

defined using a simplified form of SGML, and integrated with a simple network protocol<br />

HTTP.<br />

(1991) CERN launches the Web.<br />

The Web grew exponentially and made other Internet based information distribution systems<br />

obsolete.<br />

Web Server at Bendigo<br />

(February 1994) The Department of IT [<strong>La</strong><strong>Trobe</strong>,Bendigo] started running a Web server on<br />

"ironbark" at Bendigo (first regional institute in Australia to do so, and in the first 10<br />

nationally!)<br />

m.sutherland Page 1


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

<strong>HTML</strong> – Hyper Text Markup <strong>La</strong>nguage<br />

<strong>HTML</strong> is the coding language used for writing documents on the World Wide Web.<br />

<strong>HTML</strong> stands for Hyper Text Mark up <strong>La</strong>nguage.<br />

The original intention of <strong>HTML</strong> was to define the structure of a document without specifying<br />

exactly how a browser should display the document - the browser determines the final presentation.<br />

The original purpose of <strong>HTML</strong> was to define document structure, e.g. paragraphs, tables, lists and<br />

images.<br />

Although <strong>HTML</strong> was not originally intended to define how the document should appear when<br />

displayed, extra features were included that provide some layout and formatting control. It allows<br />

limited control over the layout and appearance of textual and graphical information.<br />

The presentation of documents is determined by how the browser "chooses" to display <strong>HTML</strong><br />

elements<br />

<strong>HTML</strong> documents are generally delivered over the Internet from a WEB server running on a host<br />

machine to a WEB client browser running on a workstation (PC).<br />

m.sutherland Page 2


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

<strong>HTML</strong> documents can also be loaded into a browser from the local file system of a workstation<br />

without the need for a WEB server. eg. <strong>HTML</strong> documents on CDROM.<br />

Without a WEB server <strong>HTML</strong> documents are only available on the local machine (or intra net<br />

machine sharing the same file system).<br />

There are three components needed to make information resources available:<br />

• A scheme for naming and locating resources (URL).<br />

• Protocols for accessing named resources (eg. HTTP, FTP).<br />

• Hypertext language for navigation between resources (<strong>HTML</strong>).<br />

An information resource could be a document, an image, a sound or video clip, style sheet<br />

definitions, a java script, java applet or some other resource needed by a WEB document which is<br />

not stored inside the current document.<br />

What does <strong>HTML</strong> provide<br />

• limited character formatting ( bold, italic and underline)<br />

• Document structure<br />

• Lists & tables<br />

• Inline images<br />

• Links to other documents and resources<br />

m.sutherland Page 3


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

Markup language<br />

markup 'tags' are used to change the properties of plain text.<br />

the cow jumped over the moon<br />

would be rendered (displayed) as:<br />

the cow jumped over the moon<br />

• The markup tag for bolding text using <strong>HTML</strong> is <br />

• Only the effect of the tag is visible when the text is displayed.<br />

• All <strong>HTML</strong> tags start with an left angle bracket < and finish with a right angle bracket>.<br />

An <strong>HTML</strong> tag can be either a closed tag or an empty tag.<br />

Closed tags have a corresponding closing tag to the opening markup tag and affect content between<br />

the two tags.<br />

examples:<br />

this text is highlighted as strong.<br />

this is bold but this is not<br />

The closing tag is the same as the opening tag with the inclusion of a "/".<br />

Empty tags have no closing tag. Eg.<br />

- horizontal ruler<br />

- forced line break<br />

- image<br />

m.sutherland Page 4


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

XML - eXtensible Markup <strong>La</strong>nguage<br />

The eXtensible Markup <strong>La</strong>nguage is another markup language.<br />

XML documents must be well formed.<br />

• All elements must have opening and closing tags<br />

• Empty elements must be expressed in XML format<br />

• All elements must be correctly nested<br />

<strong>HTML</strong> does not enforce the above three rules<br />

XML is case sensitive, <strong>HTML</strong> is not<br />

All XML based languages require that documents be well formed. Optionally, a document may also<br />

be validated against a document type definition, or DTD. A DTD defines:<br />

• The elements, attributes and entities that form the grammar of the mark-up language.<br />

• Valid document structure.<br />

m.sutherland Page 5


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

X<strong>HTML</strong> – a version of <strong>HTML</strong> that is compatible with XML<br />

eXtensible Hypertext Markup <strong>La</strong>nguage.<br />

X<strong>HTML</strong> has the vocabulary of <strong>HTML</strong> whilst using the syntax of XML.<br />

X<strong>HTML</strong> offers the following advantages:<br />

• Stricter coding rules allow the document to be more easily read and processed.<br />

While less convenient for the web developer, a document that is simpler to read<br />

requires less complicated applications to process it.<br />

• X<strong>HTML</strong> assists in separating the content of a document from its presentation.<br />

Such a separation prevents your valuable content from being mixed with<br />

presentational data. It allows the document to be used in different contexts more<br />

easily.<br />

• X<strong>HTML</strong> documents may be processed using any XML tool.<br />

Being XML based, X<strong>HTML</strong> may be processed by any XML tool, or even converted<br />

into any other XML based language.<br />

m.sutherland Page 6


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

<strong>HTML</strong> markup tags<br />

Tags begin with a left pointing angled bracket ""<br />

eg.. turn on bolding<br />

<strong>HTML</strong> tags must have a closing tag<br />

that uses the same tag name preceded by a / (forward slash)<br />

eg..this is bold but this is not<br />

Structure of an <strong>HTML</strong> document<br />

An <strong>HTML</strong> document consists of at least two sections:<br />

• head<br />

• body<br />

There is only one head and one body allowed in a document.<br />

<br />

<br />

Structuring <strong>HTML</strong> documents<br />

<br />

<br />

Working with Web Pages ( <strong>HTML</strong> documents )<br />

here is the body of the document. It is the information content of<br />

the document and includes markup tags and links.<br />

<br />

<br />

m.sutherland Page 7


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

The section:<br />

the document title is defined by the tag<br />

Other tags that can be placed in the header are not normally displayed by the browser, they<br />

provide details about the document, its status, ownership and relationship to other<br />

documents.<br />

The section:<br />

the information content of the document and includes markup tags and links.<br />

The declaration<br />

The declaration must be the very first thing in your document, before the<br />

tag. Then, when the browser begins to load the page, it knows how to treat the code<br />

within the page.<br />

The doctype declaration tells the browser what version of (X)<strong>HTML</strong> is being used so it will<br />

know how to display the page. The declaration also provides a link to a text file describing<br />

the document's standard (e.g., the loose DTD)<br />

<br />

<br />

<br />

replace with your document's title <br />

<br />

<br />

<br />

<br />

replace with your document's content<br />

There are three different document types for <strong>HTML</strong> 4.01:<br />

Strict, Transitional, and Frameset. The Strict type is used with Cascading Style Sheets and<br />

helps to ensure clutter-free coding.<br />

<br />

The Transitional type is used when <strong>HTML</strong> presentational features are included in the<br />

document instead of in a style sheet. This is done to accommodate older browsers that don't<br />

support CSS.<br />

<br />

The Frameset type is used in documents that have frames.<br />

<br />

m.sutherland Page 8


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

X<strong>HTML</strong><br />

The same three document types are also used in X<strong>HTML</strong> 1.0:<br />

<br />

<br />

<br />

Since the declaration is actually a comment tag, it won't confuse older<br />

browsers that don't understand the statement.<br />

m.sutherland Page 9


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

<br />

Faculty of Science, Technology and Engineering - <strong>La</strong> <strong>Trobe</strong><br />

<strong>University</strong><br />

the text following the opening title markup tag appears in the title bar of the browser when the page is<br />

loaded.<br />

m.sutherland Page 10


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

Using Markup tags in Web Pages<br />

• physical (presentational) elements<br />

• logical (semantical) elements<br />

o title<br />

o headings<br />

o paragraphs<br />

o tables<br />

o lists<br />

o images<br />

o anchors & links to other documents<br />

m.sutherland Page 11


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

Physical (presentational) tags<br />

These affect the appearance of text enclosed by the tag.<br />

• bold<br />

• italic<br />

• underline<br />

• typewriter text<br />

• preformatted text <br />

Empty physical style tags: these have no closing tag.<br />

• start a new line.<br />

• horizontal line<br />

• image tag - requires another piece of information about where to<br />

find the file that stores the image. “src is an attribute”<br />

<br />

<br />

My First Web Page<br />

<br />

<br />

My First Web Page<br />

<br />

I hope that you will enjoy visiting this web page<br />

<br />

The paragraph Tag<br />

<br />

The paragraph tag is used to group a collection of text into a single<br />

unit. It is possible to align the text within the paragraph to be<br />

"left", "right" or "center" on the page.<br />

<br />

<strong>La</strong>st Updated 2-Mar-2012<br />

<br />

<br />

m.sutherland Page 12


CSE2WD Web Development<br />

Introduction to <strong>HTML</strong><br />

The paragraph Tag <br />

The paragraph tag is used to group a collection of text into a single unit. It is possible to align the<br />

text within the paragraph to be "left", "right" or "center" on the page.<br />

.... <br />

.... <br />

.... <br />

align = "center" | "left" | "right"<br />

Aligns the text between the opening and closing tags to the centre, left or right of the page.<br />

this text is aligned left <br />

this text is aligned left<br />

this text is aligned right <br />

this text is aligned right<br />

this text is aligned centre <br />

this text is aligned center<br />

Pre-formatted text<br />

<br />

text following the pre markup tag is displayed using<br />

a fixed width font.<br />

Carriage returns and white space are not ignored.<br />

Monday Prepare notes set homework<br />

Tuesday Photocopy handouts confirm no. of attendants<br />

Wednesday Deliver training go home and rest<br />

Other markup tags can be embedded into the<br />

preformatted text.<br />

eg.<br />

this is bold and this is underlined<br />

<br />

m.sutherland Page 13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!