Try this HTML quiz @ W3Schools for self check
HyperText Markup Language, version 5*,
is the first language to be discussed in details in CS3226
This is the most frequently requested/served resource by client/server, respectively (from previous HTTP/S lecture)
In a nutshell, HTML documents are plain text files (created by a text editor*) typically stored on a web server
Key concepts: HTML tags, HTML document structure, URLs and hyperlinks...
element
element
is a fundamental component of the structure of a text document
element
s can contain plain text, other element
s, or both, e.g. head
, table
, p
(paragraphs), etc
tag
tag
s mark the element
s of an HTM(arkup)L file for your (web) browser and they look like this: a left angle bracket (<
), a tag name (e.g. table
), and a right angle bracket (>
)
tag
s are usually paired (start and end tag
)
— although some exception exists
The end tag
looks just like the start tag
except a slash (/) precedes the text within the brackets,
e.g. <table>
and </table>
attribute
attribute
can be included in some element
s
We can write those attributes in the start tag to convey additional information or set those attributes via separate Cascading Style Sheets (CSS) file(s),
e.g. <table cellpadding="2px">
Important attributes for dynamic websites are
id
(each element must have unique identifier) and
class
(several elements can have the same class)
HTML is not case sensitive (in general)
Examples: <table>
is equivalent to <TABLE>
or <TaBlE>
,
but just use all lowercase to avoid confusing yourself
(Web) browser support of HTML tags varies
If a browser does not support a tag, it is designed to ignore it (and thus writing a good cross-browser HTML5 file can be sometimes frustrating, but you can try this)
To test if your browser is good in handling HTML5 tags, you can check it by pointing your browser to: http://html5test.com/
PS: Let's just use Google Chrome web browser in CS3226
The standard HTML5 document structure is like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Document Title</title>
</head>
<body>
<p>Page Content Goes here!</p>
</body>
</html>
Copy paste the code above to a text editor, save it (as .html),
and open it with your browser
The <!DOCTYPE html>
tag at the beginning of an HTML5 document alerts the web browser of the specific type of HTML document to follow
The <!DOCTYPE html>
is for the HTML5 standard Document Type Definition (DTD)
There are a few other options for <!DOCTYPE>
for legacy HTML (GIYF — the HTML history is quite long)
We can add reference to external Cascading Style Sheet (CSS) and JavaScript (JS) file(s) like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Document Title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<p>Page Content Goes here!</p>
</body>
</html>
We can also put the style
and script
internally in the HTML file itself
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Document Title</title>
<style>
p { font-family: Courier; font-size: 77px; }
</style>
<script>
alert('Hello world'); // pop up an alert
</script>
</head>
<body>
<p>Page Content Goes here!</p>
</body>
</html>
You can use W3C markup validation service to check if your HTML(5) documents are valid
What are the pros/cons of external/internal CSS/JS files?
Is <script>
best placed in <head>
element?
You need to memorize some of the common HTML tag
s
and some of their important (usually styling) attribute
s
Why should I do that?
Try this HTML quiz @ W3Schools for self check