Professional Documents
Culture Documents
Structure of HTML I
Structure of HTML I
Introduction
Previous knowledge in area??
Introduction to HTML
A Webpage is a page with HTML-text A number of linked pages in one place are called a website. Hyper Text Markup Language
Introduction to HTML
Two programs needed form creating a webpage - An editor (i.e Notepad) - A webbrowser (i.e Netscape, IE) Change mode while developing Webbrowser interpret the code in file
Marks Tags
HTML is a marking language Commands for format and layout is included in the text. Command is enclosed by hooks, < and > A HTML-command is called a tag <b> It has to be closed with an end-tag </b>
Framework in a webpage
Framework tells the web browser, how the text and commands should be interpreted. Every webpage need tags that defines the head section in the document.
Structure of HTML-pages
Structure syntax of HTML-page:
<html> <head>
Properties to <BODY>
Adjustment of background
<body bgcolor=#Color index or name>
Adjustment of Text - Ordinary text <body text=#Color index> - Visited link <body vlink=#Color index> - Unvisited link <body ulink=#Color index> - Active link <body alink=#Color index>
Formatting of text
Commands for changing the layout of text
Two types of tags: - Physical - Logical
Physical tags
<b> <i> <strike> <u> <blink> bold italic line through underlined blinking text (only netscape)
Headings
6 heading sizes <hn> - <h1>, <h2>, h3>
Structure tags
<hr> <br> <p> <c> horisontal line break row new textarea centred adjusted <p align=right> right adjusted <font> color, size and font of text
Exercise 1
Textformatting Start Notepad. Save document with extension .htm Use the HTML-framework Change backcolor of your page Write a text or use textfile and try some of the physical and structure tags. Open the file in the browser
Pictures
Pictures are separate files Linked in to document with syntax
<img src=filename or URL>
Links
Links together documents in the same site or anywhere on Internet.
Link syntax:
Textlink <a href=filename> text on link </a> Picturelink <a href=url><img src=picture.gif></a>
Links
Same catalog
<a href=report.htm> linktext </a>
Under-catalog
<a href=products/report.htm> linktext </a>
Exercise 2
Adding pictures and links
Add two pictures to your webpage, one from your map and steal one from another website (URL). One of the pictures should be a link. Also make a textlink somewhere in the text.
Tables
Tables are build with cells, from left to right, up to down.
Syntax: <table></table> <th> <td> <tr>
Tables
<Table> have properties: cellpadding Margin between text and cellframes cellspacing Between cells align Textplacement in cell width Width in pixels or % of screen border By putting property border=0, tablelines disappear.
Tables
Letting the tablecell span over several rows or columns, use the properties rowspan and colspan Example:
<td colspan=2>
Special characters
Writing special characters with entities is a necessity if the character is a part of the language of HTML (ex. < and >)
Many characters does not exist in standard collection. Several blanks only become one blank in webbrowser, hard blank copes with that.
Special characters
Character Code
> <
&
> <
& &Euro; ”
MailTo
Exercise 3
Tables
1. Add a nice looking table to your webpage. It should contain all people in class with firstname and surname, possibly age!!!
1. Add a MailTo which leads to your own adress.
Form
Form
Consists of a number of elements
text row or button for input
several text rows for input choose between for defined values
<input>
<textarea> <select>
Every tag has to have a unique name Form must have a specific button to send data to server.
Type - attribute
With type -attribute, the type of <input> tag is specified. Plain text Chechbox Radiobutton Button Own button Password type=text type=checkbox type=radio type=submit type=image type=password
<input>
Width of input area (number of characters) size=x Maximum number of characters possible Maxlength=x Name of variable which contains the value Name=name (I.e txtName) Text placed in text-area by you Value=prechosen text
checkbox
User can choose between several alternatives. Have to contain name and value - If user has marked a checkbox, value = valuetext is returned - If nothing is marked, nothing is returned
radiobutton
Buttons
Executed immediately Two types: - Send (type=submit) - Reset (type= reset) Standard text of those are changed by value=text Submit sends data to server and resets form
Hidden fields
Can send data to server without involvement of user.
<input type=hidden name=text value=data>
<select>
<select size=2> <option value=value>text</option> <option value=value>text</option> </select>
If multiple-attribute is added, several elements can be chosen by user. To add selected-attribute in <option>, makes the element preselected.
Exercise 4
Forms
1. Create a new webpage 2. Make a nice looking form where you can register following personal information:
Name Sex Email Occupation Area of interest (textbox) (radiobutton) (textbox) (selectbox) (checkbox)
Frames
Frames
Syntax: <frameset></frameset> <frameset rows=150, 300, *> <frameset cols=25%, 50%, *%>
* = all space left
Frames
To hide the border between the frames, use 3 properties in <frameset>-tag <frameset frameborder=0> <frameset framespacing=0> <frameset border=0>
Use all 3 to be sure!
ie ie netscape
Frames
Put webpage in frame: <frame src= Page.htm name=middle> Make page open in one of the frames through link <a href="King.htm" target="middle">
Scrolling scrolling=yes/no/auto NoSize-changing noresize=noresize
Exercise 5
Frames
1. Create a special framedocument with the same division as the example, call it Total. 2. Your own webpage from Exercise 1-3 should be shown in the middle window. 3. The left page should contain a linklist. One of the links should go to your form in exercise 4. 4. The top page should have a heading.
Cascading style sheet is a standard for layout on webb. A layout language which allows us to connect different layots to different HTML-commands and create own classes. We can control colors, positioning, font Frameworks contains rules how webpage should look
Inline format-template: Affects the tag where styleattribute occures <p style=font-size: 30pt> Inserted format-template: Affects all p-tags in whole document.
<style> p {font-size: 30pt} </style>
Internal references
An anchor on a webpage where you can link.
Syntax: <a name=name> text or picture</a> Example: <a name="top">Top</a> <a href="#top">Go to top</a>
Internal references
From same document
<a href="#top">Go to top</a>
Exercise 6
Internal References
Create a bookmark from the bottom of your webpage to the top of the page.