Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
This course is designed to quickly lead you through the steps of building an HTML website, from creating a new page to building links and tables. Author James Williamson simplifies the coding process, with straightforward steps you can recreate on your own. The course explains the basic structure of an HTML document, shows how to add text and images, and introduces font styling with CSS. James also offers a bonus design challenge at the end of each chapter, where he asks you to think of a solution before offering his own.
The history of the doctype is a long and varied one. Suffice to say that the doctype is more or less a necessary evil for all HTML files, so yes, you do need to have one. What the doctype is supposed to do is tell the browser or user agent which version of HTML you're using so it'll know which version of the syntax to use when parsing the page. In reality, all it's really doing is triggering something that we call standards mode, so that the browser doesn't display in what we call quirks mode.
Now, this going to ensure that your page is rendered properly. And if this sounds confusing, all you have to do is just remember this: you need one and you want the doctype to reflect the version of the HTML that you're going to be authoring. They can be a little hard to remember. I certainly don't have them all memorized, that's for sure, so you want to bookmark the page that you're looking at right here with in the browser. And this is the w3.org's page on a valid DTD list. So if you search for a doctype list on w3.org, you'll get to this particular page.
Now in this page they kind of show you where the doctype goes and the syntax surrounding it, and then if I scroll down, it has the list of different doctypes. So here's HTML 4.0's Strict, Transitional and Frameset. XHTML 1.0. They even have some of the more historical ones, which is the HTML 2.0. I doubt that you'll be using too much. If you don't know which one to use, just use HTML 4.0 Transitional, which is this one right here. You can just copy and paste that into your documents, and trust me, you will not be the only web designer in the world that does that; most people do.
Now the one that they're not showing here is actually the one that we are going to be authoring in just a moment when we go back into our code editor, and that's the HTML5 document type declaration. But the HTML5 DTD is actually one that you can memorize. So let's go back into our code, and that's going to be the very first thing that we do in our HTML file. So I am going to switch back to my code editor. And I have opened up from the Chapter 02 folder, 02_02, I have opened structure.htm. Now you can see the blank document. We are starting from scratch. And the very first thing in any html file is going to be this document type declaration.
So before the opening html tag, you are going to put this in there. Now this technically is not an html tag, so if you look for the document type tag within the html reference, you won't find it in any of the specifications, because it is not html tag. It's essentially, again, just sort of indicator to the browser as to what they are going to be looking at. The easiest way to do this, I am just going to go ahead and open up on angle bracket here. I want to type in an exclamation point, which is the opening part of any document type declaration, and I am just going to type I the word doctype. Now a lot of times you are going to see doctype in all caps, sometimes you are going to see in lower case; it does not matter which one you do it.
If you like to shout and put it in all caps, that's fine. Authoring programs out there will do that. You just want to be consistent with it. After the initial doctype declaration that you see here and the doctypes that we saw on the reference page just a minute ago, after the initial doctype declaration, we saw these really long strings of URLs that pointed to schemas for specific versions of HTML. We don't need to do that anymore; all we really need to do is just indicate that this is an HTML file, and we do that by saying html. That's it.
Now, that's actually easy to memorize, so I recommend using this particular doctype declaration, even if you're yourself, well, yeah, but I am not going to use HTML5. I am going to use HTML4. It doesn't matter. All you're doing with this document type declaration is saying, what follows is HTML, and then it will go ahead, the browser will parse it correctly, and everything will be good. It'll be in standards mode and you've done exactly what you've set out to do. So there's your document type declaration. If you wanted to use one of the older doctypes to indicate a specific version, you can do so. There's nothing wrong with that.
Just copy and paste them from the reference I showed you online or from previous files. However, there is no real compelling reason not to use this HTML5 doctype, so that is what I recommend.
There are currently no FAQs about Up and Running with HTML.
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.