Hypertext Markup Language
Hypertext Markup Language, better known as HTML, is the dominant format for the transfer of information across the Internet. It was the coupling of the idea for a browser with HTML that engendered the use of the term World Wide Web .
Each HTML file is a flat text file containing tags that indicate formatting or other kinds of objects (e.g. images) to insert. HTML files follow just a few rules. Some rules are optional - they really have to do with XHTML, a replacement for HTML which we will learn later.
- Every HTML command is enclosed in < and > characters: e.g. <p>
- Basic HTML atoms are often called "tags". Every opening tag must have a closing tag. Closing tags are the same as opening tags, except that the name of the tag is preceded by a slash: e.g. <p> has closing tag </p>.
- The opening and closing tags enclose text whose format or content they specify.
- If a tag does not enclose text, it can end itself: put a slash before the > character: e.g. <br/>
- Tags must be nested properly: e.g. <b><i>bold italic text<i><b> is correct; <b><i>bold italic text<b><i> is not.
- The behavior of HTML commands can be modified by inserting style specifications in the opening tag: e.g. <p style="text-align:center"> A Centered Paragraph <p>
- HTML tags should be in lower case
Historically, HTML tags did not need to be closed, did not need to be nested properly, and it was even considered good style to write them in upper case letters. It is only with more recent updates to the language that these rules have become more important.
There are many tutorials available for HTML on the web - we list a few below.
- There is a tutorial at W3schools. You can find many more just by doing a web search for "HTML Tutorial".
- There is no more authoritative source concerning HTML than the World Wide Web Consortium
In this class we will emphasize HTML5. It has attained the status of an international standard, and most browsers support it. It provides a great deal of power that was not available in HTML4, and which required more machinery to use in XHTML. In short, it makes things that used to be difficult seem easier. It might be fair to say that it has all but killed XHTML.
Some points of style seem to be worth making.
- Always strive to keep your pages independent of the platform/browser used to view them. There are too many pages on the Web that look good in e.g. Chrome, but do not work with other browsers.
- Strive to comply with standards. There are too many pages on the Web that use old or syntactically incorrect HTML.
- Strive to avoid tables. You will fail, since tables are the only elements in HTML that give full control of alignment. However, there are too many pages on the Web that use tables much more than is necessary, and this can lead to formatting problems when content changes.
- Strive to keep procedural and structural markup separated. Use Cascading Style Sheets as much as you can.
There is a terrific site giving details of HTML and CSS at blooberry.
The last test will take place at the final exam time on
Tuesday, 12 December, from 1:30-3:30. It will be written as a one-hour (not
50 minute) exam, but you may have the full two hours for it.
In other respects it will be very like the other tests, but
comprehensive - it will emphasize Python, but cover all the
topics we have seen.
Assignment A
is posted.