The HyperText Markup Language 5, is a language that specifies the structure and content of documents. HTML5 is a living standard, defined by W3C and WHATWG.
HTML documents are stored and accessed as simple text files, so you are able to use your favorite text editor (e.g. emacs, vim, atom) to work with them. These documents are stored on the web server as .html or .htm files that are requested by your web browser.
The building block of any HTML document is an element. The elements have a start tag that includes the element name, content (optional), and end tag (sometimes implied). Below is an example of an anchor element (a hyperlink).
In this example, the <a href="http://courses.cs.usna.edu/IT350">
is the start tag, click me is the content of the element, and </a> is the end tag. Inside the start tag, we have the name of the element (a in the example) and optionally we can have one or more attribute name = attribute value pairs. href is an attribute name and https://courses.cs.usna.edu/IT350 is the attribute value. It is recommended to have the attribute values enclosed in quotes. The order in which the attribute name-value pairs are specified inside a start tag does not matter.
In this course, we will often refer to elements as "tags".
Here is a complete HTML document example:
There are two high-level tag types, block and inline tags. Block tags start their content on a new line, while inline tags continue on the same line.
Let's try a few of the more common elements using the examples below. The following tags will help with specifying special meaning for parts of the text and that will translate in special formatting for your text within HTML.
Now let's work with the overall structure of paragraphs and headings in HTML. These elements help with breaking up the content and delineating similar content.
Below are a few examples of using links and images showing the use of both absolute (has the http or https portion) and relative paths.
Let's make a few bulleted (unordered) <ul> and numbered (ordered) <ol> lists.
There are different options that can be used with these types of lists. For example, unordered lists can be presented in different ways using the style attribute. Try adding style="list-style-type:square" to the <ul> tag above.
HTML5 introduces several new elements to better express in HTML the structure of a document. Some of these elements are:
All of your HTML files should be well formed, which means that all elements should properly nest within each other. In general you should also close your elements, unless the element does not have a closing tag (e.g. img).
As a general guideline, all element names should be lowercase. While capitalized versions will work, it is bad form. Attributes should be enclosed in double-quotes.
ALl the HTML pages that you create for this class should be valid HTML5 pages. See the resources on the main course page for validators you can use to check that the HTML files you create are valid.
<!DOCTYPE html>
<!-- An example file
<!-- Our first Web page -->
<html>
<body>
<h1> Welcome to <b> IT350! </h1> </b>
<h2> Today’s Agenda </h2>
<li> HTML5
<li> JavaScript
</body>
<!DOCTYPE htm>
<html>
<title>Internet and WWW How to Program - Welcome</title>
<body>
<img scr = "html.jpg" height = "238" width = "183" >
<h1 align=“center”>Under construction</h1>
</body>
</html>
<html>
<head>
<title>Internet and WWW How to Program - Links</title>
</head>
<body>
<b> <h1>Here are my favorite links</h1> </b>
<p><A href = "http://www.yahoo.com">Yahoo!</A></p>
<p><A mailto = "webmaster@ussmichigan.org">Webmaster</A></p>
</body>
</html>
<!DOCTYPE html>
<html>
<head> <title>Best features of the Internet</title> </head>
<body>
<ul>
<li>Meet new people from around the world.</li>
<li>Access to new media as it becomes public: </li>
<ul>
<li>New games</li>
<li>New applications & software
</ul>
<li>Search engines</li>
</ul> </body>
</html>