Chapter 1: Introduction
Introduction
In our last lesson, we left our friends at WatzThis.com about to present their mobile app to potential investors. For the next three lessons, we're going to freeze time in their universe, so we can back up and look at how their budding mobile app actually works. We'll consider some good ideas (goodness knows they need them) to help them improve their app and get the funding they need.
What Is HTML?
HTML stands for Hypertext Markup Language. Invented by a physicist named Tim Berners-Lee in 1990 as a way to share documents on the Internet, HTML made the World Wide Web possible. Today, there are billions of webpages on the Internet that search engines know about, plus many more that search engines haven't indexed yet. Billions more can't be indexed because they're access-restricted. Almost all of these webpages use HTML.
To say that HTML is a popular and widely used language is an understatement. The reasons for HTML's success include:
- It's easy to learn.
- It's forgiving of mistakes.
- It's relatively intuitive.
- It happened to be in the right place at the right time (dumb luck, in other words).
Hypertext wasn't a new idea when Tim Berners-Lee built it into his language. Others had proposed it decades earlier, and plenty of people and companies had actually built and worked with hypertext systems before HTML. Perhaps the most successful was Apple Computer's HyperCard system.
Hypertext makes it possible for objects within documents to link to one another and to other documents. Today we're all familiar with this concept, and many of us use it every day.
For example, let's say you're reading a movie review online. The name of an actor might link to a biography of that actor. That biography might be a link to the complete list of films in which the actor has acted. Each of those films might link to more detailed information. And so on, and so on, and so on.
The "ML" part of HTML stands for "markup language." Markup languages are a way of using text to describe text or to tell a computer what to do with a piece of text. The word "markup" comes from the publishing industry, in which editors "mark up" manuscripts to indicate changes they want to make to the text.
HTML is the way that website developers mark up text, images, and other types of content to tell Web browsers what to do. Web browsers are, essentially, programs for downloading and interpreting markup language and then doing something with the results (most often displaying them).
For example, in HTML, the following code indicates that the words "This is small text" should be displayed in small type.
This is small text.
Web browsers read and interpret the characters inside the angle brackets as special instructions. Browsers use those instructions to figure out what to do with the text in between and .
People have made many improvements to HTML since its beginning, but the "hypertext" and "markup language" parts of it are still the keys to understanding it.
HTML5 is—you guessed it—the fifth version of HTML. It's also the first major revision ofHTML since HTML 4.01, which the World Wide Web consortium officially adopted as the standard version back in2000. HTML5 is became the official, standardized version of HTML in October, 2014.
HTML5 represents a renaissance of HTML, in a way. After HTML 4.01 was standardized, many of the academics, companies, and other smart people who write the standards decided it'd be a good idea to replace HTML with a new language: XHTML. This effort failed to gain the sort of popular support that HTML enjoyed. Why, you ask?
- XHTML isn't as easy to learn as HTML.
- It isn't as forgiving of mistakes as HTML.
- It isn't as intuitive as HTML.
- XHTML was a top-down effort. In other words, the standards organizations led the process rather than taking their cues from the needs of Web developers.
HTML5, on the other hand, continues the path of HTML 4.01. It takes advantage of the strengths of earlier versions of HTML while improving upon those strengths and building in exciting new capabilities and features.
One great example of how HTML5 makes developers' lives easier is with how it deals with errors. In previous versions of HTML, Web browsers reacted inconsistently when they encountered incorrect code. A bug that one browser hardly noticed might cause another browser to display the webpage completely wrong. For years, Web developers have been learning tricks and creating workarounds for some of these cross-browser issues. But it's nearly impossible today to create a webpage with any amount of complexity that will look and work exactly the same on two different Web browsers.
To combat this problem and make Web developers' lives easier, the HTML5 specification, for the first time, details exactly how Web browsers should respond to poorly written or incorrect code.
Style vs. Purpose
HTML was invented to tell Web browsers how to format text in a document. Shortly thereafter, the debate began about exactly what sort of commands, or tags, should be in the language.
At first, things were chaotic. Tags like <blink>, <font>, <center>, <img> (for image), and <u> (for underline) specified how text should look. Tags like <table>, <address>, and <form> specified what the elements are.
Most people who make the rules feel that the proper role of a markup language is to identify what the meaning of the content is rather than how it should look (more like the second group of tags in the examples above). Using HTML to describe the meaning of webpages is semantic HTML. One of the big improvements of HTML5 is that it introduces a slew of new tags for specifying the meaning and purpose of content.
One of the benefits of semantic HTML over presentational HTML (which merely tells browsers what the content should look like) is that semantic HTML is useful for other types of devices besides desktop computers. For example, HTML code that specifies that a word should be red is useless when a text-to-speech program reads it. How do you speak "red"?
You can make content display in red on a webpage, but the proper way to do that is with a styling language rather than with HTML. You'll learn about the style language of the Web, CSS, in Lesson 4.
HTML5 Does Multimedia
In the past, Web developers relied on plug-ins—such as Apple QuickTime or Adobe Flash—to play audio and video files. But HTML5 has support for audio and video built right in.
Here's how you embed a video in a webpage with HTML5:
<video src="myvideo.ogg" width="550" height="400"> <p>This text will display on older browsers. It should describe the video.</p> </video>
That's all there is to it!
Accomplishing this same task pre-HTML5 required Web developers to use a special markup that was specific to the plug-in, and it required the user to install the right plug-in. Quite often, there was a problem somewhere in the process that would cause the video to not play.
Here's how you embed audio in an HTML5 document with the new <audio> tag:
<audio src="mysong.ogg" controls="controls"> <p>Here's the alternative text for older browsers.</p> </audio>
At this point, I feel like I need to point something out in order to avoid confusion later on. HTML5 doesn't actually play audio or video in the same way that plug-ins like QuickTime and Flash do. HTML5 merely defines how browsers should support the control and playing of video and audio using HTML5 tags. The browser does the actual work.
Regardless of how the inner details work, the result is that the confusing and incompatible world of audio and video playback on the Web is ending.