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.
As I mentioned earlier, HTML is a markup language. This means that HTML uses tags to format the content of the page. Once you're comfortable with the syntax behind formatting content, then it simply becomes a matter of learning which tags are available to you for formatting and the options you have when using them. To illustrate that concept a little bit more clearly, I'm going to be using the format.htm file you see here. So you can see here, within the body of our page, we just have a single line of text that says, "What am I?" Well, currently that line is not being formatted at all.
It has no tag around it to identify it, other than belonging to the body of the page. Now, if I were to preview this in the browser, you can say that it does display on the page as just a single line of text, and it sort of has the default font size and formatting that you would expect to find in just regular paragraph text. So the browser is basically just giving you the default formatting for text within the browser. However, if I go back into the code, I can change the formatting of this text by simply applying another tag around it. So that's exactly what we are going to do.
So right around "What am I?" I am just going to ahead and create a new tag. I am going use a pre tag. Now, I don't think we've seen this one so far in the title. We will be seeing this a little bit later on as well. So again, I am just going to do an opening and closing tag that wraps around the text "What am I?" I am going to go ahead and save this. If I go back into my browser and refresh my page, I can see that the text does indeed change formatting. Just because you're changing formatting doesn't mean that everything that we do in HTML is presentational; it's actually the other way around.
HTML describes the structure of the document, so essentially pre, which stands for preformatted, you're telling the browser this is preformatted text. Every single browser out there has what we call a default style sheet. Now what that means is is basically there's a little style sheet that says, okay, what type of element is that? This is how I am going to format and display that on the page. Now, using your own styles, you can override those, and we will do that a little bit later on in this title. But for the most part, the formatting that we are seeing on the page is actually representative of what type of element it is.
You can see preformatted text, for example, is typically displayed in a monospaced font and the reason for that is because that pre tag is used a lot around code snippets or code segments or things like that, so monospace fonts are typically really good for that. Of course, you can use CSS to style it any way that you want. So if I go back in and I change the tag that's around it, I am going dramatically change the meaning of the text. So right now it's preformatted text, but if I surround this with, say, an h4, which is a heading4 and save that and test it, I can see it again the text changes.
It's bigger, it's bolder. It's now a heading. I notice that it's not that large, because it's a heading4. If on the other hand I change that to a h1, which is a top-level heading, save that, and test it, you can see the text gets a lot larger. Again, the browser is simply giving you a visual representation of what type of element that is. We're not actually passing any formatting instructions whatsoever. So for the most part, when you apply a tag around text to create an element, you are essentially telling the browser, or whatever user agent is parsing that page, what type of semantic structural element it is.
Now, it's not always so cut and dry, in terms of being structural versus presentational. Let me show you what I mean. Let's go back into our code, back into our heading1. What about the text "am?" What if I wanted to change that and italicize that, or make it appear italicized within the heading? It's very easy for me to do by just using the i tag, or the italics tag. So I am going to go ahead and wrap the word "am" in the italics tag, and of course it's okay to nest one tag inside of another. So if I save this, go back in, and preview my page, I can see that now the word am is indeed italicized.
The italics tags, along with tags like the bold tags, are a small section of tags within HTML that are entirely presentational. And what that means is they don't actually mean anything. We didn't change the meaning of this text at all. We just informed the browser to go ahead and display that text as being italicized. There is a big movement among web designers and developers over, say, the last five to ten years, to be honest with you, to separate presentation from structure. And what that means is is the goal is to just have your code represent the structure of the text--what type of element this is--and then you allow CSS, which is a presentational language, to control how it looks.
But there are still some more remnants of presentational markup in HTML and the italics tag is one of them. When would you use it? Well, for a case just like this, when I wanted to italicize that text but not necessarily affect its meaning. Again, as I mentioned, that's not always cut and dry, because there are other tags out there that seemingly do the same thing. Let's say for example I use the em tag, em, instead of the italics tag. If I saved this and previewed it, nothing changes. It's still italicized. However, behind the scenes there is actually a much bigger change.
The em tag stands for emphasis. So now the word "am" is being emphasized, whereas before it was merely being italicized. And we are going to explain this a little bit later on in this chapter as we talk about emphasizing text and what the difference is between some of these presentational versus structural elements are. That's why it's so important to understand what these tags are and what they're doing and what they're saying about the underlying text. As a markup language, all you really need to do to properly format content in HTML is to simply wrap it in the appropriate tag.
Of course, this means that part of the joy of learning HTML is learning all of the different tags and when they are appropriate.
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.