CSIT128 / CSIT828: Joseph Tonien
CSIT128 / CSIT828: Joseph Tonien
HTML
Joseph Tonien
HTML
<html>
<head>
<title>JT</title>
</head>
<body>
Hello World!
</body>
</html>
The first HTML document
<html>
<head>
<title>JT</title>
</head>
<body>
Hello World!
</body>
</html>
HTML document structure
<html>
● A HTML document starts with
<head> <html> and ends with </html>
</body>
</html>
HTML tags
<html>
<head>
tag
<title>JT</title>
</head>
<body>
Hello World!
</body>
</html>
HTML tags
tags are NOT case sensitive
<html>
<head>
tag
<title>JT</title>
</head>
most tag goes in pair
<body>
<tagname>content</tagname>
Hello World!
</body>
start tag end tag
</html>
<h1>Heading 1</h1>
Heading tags: <h1>, <h2>,..., <h6>
<h2>Heading 2</h2>
<h1> the most important heading
<h3>Heading 3</h3>
<h6> the least important heading
<h6>Heading 6</h6>
Normal text...
</body>
Paragraph tag <p>
<body>
<p>This is a paragraph</p>
Extra spaces and lines will NOT
<p>Another be displayed in paragraph
paragraph</p>
<p>yet another
paragraph</p>
</body>
Line break <br />
<body>
<p>This is a paragraph</p>
<br /> tag defines a line break
<p>Another <br />
<br /> is an empty element
paragraph</p> (i.e. it is a tag with no content),
it combines the start and end
<p>yet another <br /> tags together
<br />
paragraph</p>
</body>
Horizontal line <hr />
<body>
<p>This is a paragraph</p>
similarly, we have the
<p>Another <br /> horizontal line tag <hr />
with no content
paragraph</p>
<hr />
<br />
paragraph</p>
</body>
Non-breaking space
<body>
<p>This is a
use for non-breaking space
paragraph</p>
paragraph</p>
<hr />
<br />
paragraph</p>
</body>
Character entity
● Some characters are reserved in HTML.
o ° Degree
© © Copyright
Character entity
<body>
<body>
<p>normal paragraph</p>
<blockquote>
</blockquote>
</body>
Formatting text
<body>
</body>
Formatting text
<body>
</body>
Formatting text
<body>
Some math
x<sub>1</sub><sup>n</sup> +
x<sub>2</sub><sup>n</sup> =
y<sub>1</sub><sup>n</sup> +
y<sub>2</sub><sup>n</sup>
</body>
Preformatted text <pre>
<body>
<pre>
pre element is shown in monospace
Mary
it preserves the character and line spacing
had a
little
lamb
</pre>
</body>
Computer code
<body>
<pre>
<code>
a = 0;
b = 3;
c = 2;
sum = a + b + c;
</code>
</pre>
what would happen if we use <code> … </code>
</body> without <pre> ?
If you want to include special characters such as
Computer code < > & " '
within pre tags, they should be substituted by
<body>
character entities so that they are not subject to
<pre>
special interpretation by the browser.
<code>
#include <iostream>
void main( ) {
cout << "Hello World!" << endl;
}
</code>
</pre>
</body>
#include <iostream>
void main( ) {
cout << "Hello World!" << endl;
}
Image
<body>
</body>
Attribute Description
src URL of an image, for example
src="uow-logo.png"
src="images/uow-logo.png"
src="http://www.mycom.au/staff.png"
height optional.
width Specifies height, width for image in pixels, or in percentage
Image alt
<body>
</body>
Absolute URL
src="http://www.mycom.au/staff.png"
Relative URL
src="images/logo/uow-logo.png"
src="/../f1/bird.png"
Tag attributes
<body>
</body>
</body>
Link
<a href="http://www.uow.edu.au" target="_blank">Visit UOW</a>
target description
href="contact.html"
href="assignment/a1.html"
href="../handout/note5.html"
Link
<a href="http://www.uow.edu.au" target="_blank">
Within the link tag <a href...> </a>, we can put any text or image.
<h3 id="Proofs">Proofs</h3>
…
<h3 id="Notes">Notes</h3>
…
<h3 id="References">References</h3>
…
<h3 id="Proofs">Proofs</h3>
…
The id value must be unique and must contain at least one character.
The id value must not contain any space characters.
Link - target within document
We can create a link to a specific location within a html page
For example:
<a href="https://en.wikipedia.org/wiki/Euler%27s_theorem#Proofs">
Proof of the Euler theorem</a>
Unordered List
My timetable:
<ul>
</ul>
My timetable:
<ol>
</ol>
My timetable:
<dl>
<dt>MATH222</dt>
<dt>CSCI204</dt>
<dt>ISIT206</dt> MATH222
Mon 8:30-10:30 lecture
<dd>Wed 8:30-10:30 lecture</dd>
CSCI204
</dl> Tue 9:30-11:30 lab
ISIT206
Wed 8:30-10:30 lecture
Table
<table border="1">
<tr>
<th>Username</th>
<th>First name</th>
<th>Last name</th>
</tr>
<tr>
<td>jsmith</td>
<td>John</td>
<td>Smith</td>
</tr>
<tr>
<td>mlee</td>
<td>Mary</td>
<td>Lee</td>
</tr>
</table>
border="0"
Table
<table border="1" width="50%">
<caption>User information</caption>
<tr>
<th width="20%">Username</th>
<th width="40%">First name</th>
<th width="40%">Last name</th>
</tr>
<tr>
<td align="center">jsmith</td>
<td align="right">John</td>
<td align="right">Smith</td>
</tr>
<tr>
<td align="center">mlee</td>
<td align="right">Mary</td>
<td align="right">Lee</td>
</tr>
</table>
Table
<table border="1" width="40%">
<tr>
<td colspan="2">STUDENT DETAILS</td>
</tr>
<tr>
<td width="30%">STUDENT NAME</td>
<td>John Lee</td>
</tr>
<tr>
<td>STUDENT NUMBER</td>
<td>1234567</td>
</tr>
<tr>
<td>UOW EMAIL</td>
<td>jlee@uowmail.edu.au</td>
</tr>
</table>
index.html
When we go to http://www.uow.edu.au/~dong/w3/example/html2
● It stops people from knowing the content and structure of your website
I don’t have index.html for the directory html, that is why everybody can see the
content of my directory
http://www.uow.edu.au/~dong/w3/example/html
https://www.lifewire.com/index-html-page-3466505
<body>
<!-- this is
a long comment
-->
</body>
References
http://www.w3schools.com/html
http://developer.mozilla.org/en-US/docs/Web/HTML