Appendix F. HTML Summary

A Brief Introduction to HTML

A web page is written in a language called HTML (Hypertext Markup Language). Like Java code, HTML code is made up of text that follows certain strict rules. When a browser reads a web page, the browser interprets the code and renders the page, displaying characters, fonts, paragraphs, tables, and images.

HTML files are made up of text and tags that tell the browser how to render the text. Nowadays, there are dozens of HTML tags—see Table 1 for a summary of the most important tags. Fortunately, you need only a few to get started. Most HTML tags come in pairs consisting of an opening tag and a closing tag, and each pair applies to the text between the two tags. Here is a typical example of a tag pair:

Java is an <i>object-oriented</i> programming language.

The tag pair <i> </i> directs the browser to display the text inside the tags in italics:

Java is an object-oriented programming language.

The closing tag is just like the opening tag, but it is prefixed by a slash (/). For example, bold-faced text is delimited by <b> </b>, and a paragraph is delimited by the tag pair <p> </p>.

<p><b>Java</b> is an <i>object-oriented</i> programming language.</p>

The result is the paragraph

Java is an object-oriented programming language.

Another common construct is a bulleted list. For example:

Java is

  • object-oriented

  • safe

  • platform-independent

Here is the HTML code to display it:

<p>Java is</p> <ul><li>object-oriented</li> <li>safe</li> <li>platform-independent</li></ul> ...

Get Big Java, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.