Download Basic HTML-Web Programming-Lecture Slides and more Slides Web Programming and Technologies in PDF only on Docsity!
COMP519: Web Programming
Autumn 2011
Basic HTML
ļ§ hypertext
ļ§ tags & elements
ļ§ text formatting
ļ§ lists, hyperlinks, images
ļ§ tables, frames
ļ§ cascading style sheets
- inline, document, external
Hypertext & HTML
⢠HyperText Markup Language (HTML) is the language for specifying the static
content of Web pages (based on SGML, the Standard Generalized Markup
Language)
ļ§ hypertext refers to the fact that Web pages are more than just text
can contain multimedia, provide links for jumping within the same document & to other
documents
ļ§ markup refers to the fact that it works by augmenting text with special symbols (tags) that
identify the document structure and content type
My intention is that you design your webpages to the XHTML 1.
Strict standard (or better).
If you want, you can also use the HTML 5 specification (which, for
the material I teach in this module, is largely the same, but adds
additional features for some multimedia support).
I will be enforcing this standard in your assessments (as
much as possible).
More will be said when I discuss Document Type Declarations
(soon).
In this courseā¦
Web Development Tools
⢠many high-level tools exist for creating Web pages
e.g., Microsoft FrontPage, Netscape Composer, Adobe PageMill,
Macromedia DreamWeaver, HotDog, ā¦
also, many applications have "save to HTML" options (e.g., Word)
for most users who want to develop basic, static Web pages, these are fine (but many of these
programs produce very poorly structured HTML code)
⢠assembly language vs. high-level language analogy
ļ§ may want low-level control
ļ§ may care about size/readability of pages
ļ§ may want to "steal" page components and integrate into existing pages
ļ§ may want dynamic features such as scripts or applets
ļ§ remote editing of web pages may only be possible using a basic text editor
ļ§ sticking to (internationally and industrially) agreed upon standards will help ensure
your web documents are rendered as you intend them to look and operate as you
desire
⢠so, why are we learning low-level HTML using a basic text editor?
Structural Elements
⢠an HTML document has two main structural elements
ļ§ HEAD contains setup information for the browser & the Web page
e.g., the title for the browser window, style definitions, JavaScript code, ā¦
ļ§ BODY contains the actual content to be displayed in the Web page
My first HTML document
Hello world!
HTML documents begin and end with
and tags
Comments appear between
HEAD section enclosed between
and tags
BODY section enclosed between
and
* Find more info on HTML docs!
view page
ļ§ The element is where you include a element (that appears in
the title bar of the browser).
ļ§You can also include lots of other type of information in the <head> element.
o Cascading Style sheet information, or a link to an external style sheet (or several)
o āMetaā data, such as who authored the page, the type of content, and clues that
search engines may (or may not) use to help categorize your page
o JavaScript code
ļ§The <body> element contains the main bulk of the material to be displayed on
the webpage.
o Paragraphs
o Tables and lists
o Images
o JavaScript code
o PHP code can be included here too (if passed through a PHP parser)
o Other embedded objects
<head> and <body> elements
Separating Blocks of Text
can specify headings for
paragraphs or blocks of text
ļ§ ā¦ tags produce a large,
bold heading
ļ§ ā¦ tags produce a slightly
smaller heading
ļ§ ā¦ tags produce a tiny
heading
can insert a horizontal rule to divide
sections
ļ§ draws line across window
Blocks of Text
Major heading 1
Here is some text.
Subheading
Here is some subtext.
Major heading 2
Here is some more text.
view page
The Basic Web page ā A Worked Example
Bill Smiggins Inc.
Bill Smiggins Inc.
About our Company...
This Web site provides clients, customers,
interested parties and our staff with all of
the information that they could want on
our products, services, success and failures.
Products
We are probably the largest
supplier of custom widgets, thingummybobs, and bits
and pieces in North America.
view page
Lists
there are 3 different types
of list elements
ļ§ ā¦ specifies an
ordered list (using numbers
or letters to label each list
item)
identifies each list item
can set type of ordering, start
index
ļ§ ā¦ specifies
unordered list (using a
bullet for each)
identifies each list item
ļ§ ā¦ specifies a
definition list identifies
each term
identifies its definition
* We will learn more about the
āstyleā attributes soon enough.
(Sort of) Simple Lists
... first list item... ... second list item... ...
Dweeb young excitable person who may mature into a Nerd Hacker a clever programmer Nerd technically bright but socially inept person
Makes first item number 30. Next item continues to number
view page
Hyperlinks
perhaps the most important
HTML element is the hyperlink,
or ANCHOR
ļ§ ā¦
where URL is the Web address of the
page to be displayed when the user
clicks on the link
if the page is accessed over the Web,
must start with http://
if not there, the browser will assume it
is the name of a local file
ļ§ ā¦
causes the page to be loaded in a new
Window
* Find more info on attribute TARGET
Hyperlinks
The University of Liverpool
Open page07 in a new window
view page
Hyperlinks (cont.)
Internal Links in a Page
[ HTML | HTTP | IP | TCP ]
Computer acronyms:
HTML HyperText Markup Language HTTP HyperText Transfer Protocol⦠IP Internet Protocol⦠TCP Transfer Control Protocolā¦
Internal links are handled slightly
differently in HTML 5.
Use the same format to specify the
hyperlinks, but use an āidā to define
the location of the anchor. This can
be applied to (nearly) any HTML
element.
Images
can include images using img
ļ§ by default, browsers can display GIF and JPEG files
ļ§ other image formats may require plug-in applications for display
again, if file is to be accessed over the Web, must start with http:// (if not, will assume local file)
* Find more info on
Image example
The Anglican Cathedral of Liverpool
view page
Tables
⢠tables are common tools for arranging complex layout on a Web page
ļ§ a table divides contents into rows and columns
ļ§ by default, column entries are left-justified, so provide for alignment
Tables
A Simple Table
Left Column Right Column
Some data Some other data
⦠specify a table
element
⦠specify a row in the table
⦠specify table data (i.e., each
column entry in the table)
view page
Layout in a Table
can have a border on tables using
the āborderā attribute
increasing the number makes the border thicker
can control the horizontal & vertical
layout within cells
can apply layout to an entire row
We will explore this more with
Cascading Style Sheets (CSS).
Table Layout
Left
Column
Right Column
Some data
Some data
view page