Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
In HTML5 First Look, author James Williamson introduces the newest HTML specification, providing a high-level overview of HTML5 in its current state, how it differs from HTML 4, the current level of support in various browsers and mobile devices, and how the specification might evolve in the future. Exercise files accompany the course.
In this movie we will begin to create our HTML5 layout by creating our initial page and making sure the doctype declaration is correct. Before we begin creating our page, let's take a moment to explore doctype declarations, why they were necessary, and what HTML5 requires regarding them. As you've discussed previously, the history of HTML is a bit messy. Early on specifications weren't as widely followed and browser implementation varied widely. As HTML matured, browsers that were written to author the latest specification would tend to break if presented with earlier non-conforming HTML. To ensure older pages still worked, browsers created two rendering modes.
Quirks mode and Standards mode. Quirks mode would render the older non- valid code, while Standards mode would ensure that pages were rendered correctly based on the current specification. Of course, this just presented another problem. How would browsers know which mode to use? The solution was to include a doctype prior to the HTML tag that would identify which version of HTML or XHTML was used to author the page. Since older versions of HTML didn't require doctypes, the absence of one would trigger Quirks mode.
As a result of the many variations of HTML and the rendering requirements, a bewildering array of doctypes sprang up. XHTML for example had a doctype for the three flavors of XHTML: strict, transitional and frame set. Here's one now. Well, HTML5 is designed to be both backwards compatible and a single flavor, if you will. All the doctype in HTML5 declares is that it's an HTML document. I've read in a few places that the doctype isn't required for HTML files, but that's not altogether accurate.
The specification states that a doctype is required to trigger Standards mode, but that it serves no other purpose. Because of this, they've simplified it considerably. Behold the new HTML5 doctype in all its glory! You know what? That's actually easy enough to memorize. With that in mind, let's create a new page and add the HTML5 doctype. So again, I'm going to use Dreamweaver to do this, but you guys can use any HTML editor you like. It does not matter.
You can even use a text editor, and if you're used to creating your HTML documents that way, you can just go ahead do that. Okay, I am going to create a new HTML file. Now, Dreamweaver is really nice and tries to help you out, because it knows that no one would ever remember the doctype declarations for older document types. As a matter of fact, I'm betting if you use a different type of code editor, it has some similar type of functionality or you probably have document types saved as snippets. Well again, that's long. It's not necessary anymore. It doesn't identify our document as being HTML5 file, so it is gone.
Just go ahead and create a blank line at the very top of the page, there we go. All right, now, with all the fanfare that's necessary, we are going to go ahead and create a HTML5 doctype. We are just going to go ahead and type in exclamation point, doctype, space, HTML and close it. That's it. Now make sure that you don't have any white space prior to the doctype. If you do have empty lines above that, that could also trigger Quirks mode. So regardless of how you're creating that, you want to make sure you don't have any space up there. That's it.
I am going to go ahead and save this file and I'm going to save it out to my Exercise_Files that I copied over to the desktop earlier, and inside my Exercise_Files I am going to find Chapter3, I am going to go in the 03_05, and I am going to save this as trails.htm. So this is the page that we are going to be building a little bit each time as we go. I am going to go ahead and hit Save, and for the most part our page is ready to go. Well, that's it really. That's all that's required to serve up an HTML5 page. Now the doctype is one of the things within HTML5 that has been thankfully simplified from previous versions. Even if you have to hand code the doctype yourself, I think you will agree it's pretty easy to remember and pretty easy to execute.
There are currently no FAQs about HTML5 First Look.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.