Info2180 Lecture 2
Info2180 Lecture 2
HTML
Photo by Goran Ivos on Unsplash
HYPERTEXT MARKUP
LANGUAGE (HTML)
HTML
HTML ATTRIBUTES
NESTING ELEMENTS
▸ Ensure that they are properly nested (as shown above) and
not the following:
EMPTY ELEMENTS
fi
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My First HTML Page</title>
</head>
<body>
<p>This is my paragraph</p>
<img src="images/firefox-icon.png" alt="My test
image" />
</body>
</html>
HTML
DOCTYPE
An instruction to the web browser about what version of HTML the page is written in.
<!DOCTYPE html>
HTML ELEMENT
<html>
…
</html>
HTML
HEAD ELEMENT
<head>
<meta charset="utf-8">
<title>My First HTML Page</title>
</head>
HTML
TITLE ELEMENT
The <title> element. This sets the title of the page, which is the
title that appears in the browser tab the page is loaded in. The
page title is also used to describe the page when it is
bookmarked and used in Search Engines as the title for search
engine results.
META TAGS
<meta charset="utf-8">
<meta name="description"
content="Learn to create awesome websites." />
<meta name="keywords" content="html, css, javascript" />
<meta name="author" content="John Doe">
BODY ELEMENT
The <body> element. This contains all the content that displays
on the page, including text, images, videos, games, playable
audio tracks, or whatever else.
<body>
<p>This is my paragraph</p>
<img src="images/firefox-icon.png" alt="My test image" />
</body>
HTML
PARAGRAPHS
<p>This is my paragraph</p>
fi
HTML
IMAGES
<img src="images/firefox-icon.png"
alt="Firefox logo" width="250"
height="350" />
HTML
HEADINGS
<h1>My main title</h1>
<h2>Level 2 heading</h2>
<h3>Level 3 heading</h3>
<h4>Level 4 heading</h4>
<h5>Level 5 heading</h5>
<h6>Level 6 heading</h6>
HTML
LINKS
▸ Links are what makes the Web A WEB. They link to other
web pages or les.
<a href="https://www.mona.uwi.edu/">UWI
Mona</a>
<a href="documents/
mydocument.pdf">Download Document</a>
fi
HTML
LINKS
<body id="top">
...
<a href="#top">Back to top</a>
...
</body>
HTML
COMMENTS
LISTS
<ol>
<li>technologists</li>
<li>thinkers</li>
<li>builders</li>
</ol>
HTML
<ul>
<li>technologists</li>
<li>thinkers</li>
<li>builders</li>
</ul>
HTML
<dl>
<dt>Fun</dt>
<dd>amusing or entertaining</dd>
<dt>Learn</dt>
<dd>gain or acquire knowledge</dd>
</dl>
HTML
TABLES
▸ HTML Tables are used to to mark up structured tabular data.
▸ The <td></td> element de nes a table cell and when more than on
is used within a table row, it creates columns.
▸ You can also create table headings use the <th></th> element.
TABLES
FORMS
▸ An HTML form is used to collect user input. And the input is
often sent to a server to be processed.
▸ To add a form you use the <form> element and this will wrap
other elements.
FORMS
▸ e.g.
<form action="process_data.php" method="post">
fi
HTML
FORMS
▸ The <input> element is the most frequently used and can be
displayed differently depending on it's type attribute.
fi
HTML
FORMS
▸ So a simple form could look like the following:
</form>
HTML
</form>
HTML
FORMS - CHECKBOXES
<form action="/process_data.php" method="post">
<div>
FORMS - TEXTAREA
▸ You can (and really should) set the language of your web
page. This can be done by adding the lang attribute to the
opening html tag.
<html lang="en-US">
USING SEMANTIC
HTML
HTML
SEMANTIC HTML
Bad
<font size="6">
<strong>This is a heading</strong>
</font>
Good
<h1>This is a heading</h1>
HTML
Bad Good
<p>Supermarket list</p> <h1>Supermarket List</h1>
<p>Sugar<br> <ul>
Butter<br> <li>Sugar</li>
Eggs<br> <li>Butter</li>
</p> <li>Eggs</li>
</ul>
HTML
http://www.soswebdesign.com/gallery/webstandards.cfm
WEB STANDARDS
WEB STANDARDS
RESOURCES