Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Gain a deeper understanding of HTML5 and learn how to create richer, more meaningful web pages with structural tags and descriptive attributes. In this course, author James Williamson presents an overview of HTML5 and its development, defines the new tags and attributes, and discusses how browsers parse and display HTML5 content. The course also includes step-by-step instructions for constructing an HTML5 document with a header and footer, navigation, content groups, and formatting.
The small element is another element that has been around for quite some time but has been entirely redefined in HTML5 to something that will hopefully be a little bit more useful to authors. In HTML 4, the small element was simply defined as text that the browser should render in a small font, without giving it really any additional information or meaning. Now, in HTML5, the element has been redefined to represent legal text or other text that would be normally considered fine print. So I want to read a little bit from the specification here, you see.
So you can see again I'm in the author view of the HTML5 specification, and I have navigated to the small element. I'll scroll down a little bit here, and you can see, the small element represents side comments such as small print. And again, we get a little note here that expounds on that: "Small print typically features disclaimers, caveats, legal restrictions, copyrights," things like that. Now, here is the other thing; the small element does not de-emphasize, or lower the importance of, text emphasized by the em element or marked as important by the strong element.
Really, all this is doing is identifying this as being fine print or a disclaimer. So it's a specific type of content, not necessarily the importance of it. Now, there is another thing in the description that I want to make sure gets passed along, and that is that the small element should not be used for extended spans of text. So no multiple paragraphs, no lists, no really complex structures inside of it. It's just supposed to be used for shorter runs of text where you have that one specific legal statement or a link or something of that nature.
Now it's still a small run of text, and it's still just inside the paragraph, so I'm not going to do multiple paragraphs here. I'm going to go inside the paragraph and just do small tag, so open the small tag there, close it there. So it's very much--you can think of it sort of as an inline element; it occurs over really small runs of text-- so, no complex structures. All right! I'm going to go ahead and save that and preview that in a browser. If I scroll down, we can see the effect that using the small element has had on our text visually.
The browser is reducing the size of that, so it does give the appearance of being fine print, if you will, while it's also passing along the information semantically. Now one of the things I'd like to do to this is I would also like the text to be represented in italics. So not only do I want it to shrink down a little bit, but I also want it to be italicized. Now, browsers aren't going to do that with small text automatically, so I'm going to have to do that through my styles. So I'm going to go back into my page, and I want to open up the main.css file. So I am going to go all the way down to the very bottom of my styles.
I'm just going to add a new selector right down here. I'm going to type in 'footer#pageFooter small'. So I'm saying any time you find text inside of a small element inside of a footer with ID of page footer, and really, we're just going to do a font style. And the font style that we're going to apply to this of course is italic because we want to italicize the text. Okay, perfect! So now, I'm going to save this, and let's go back in and I'm going to preview that once again in the browser.
Now, when I scroll down, I can see that not only is our fine print a little smaller, but it's also now italicized. So now, our legal data is not only displayed as fine print, but is being represented as fine print by our code as well. Now just keep in mind if you're going to use it that the small element is for smaller segments of text, not longer passages of text. And remember the restrictions on what type of content can go inside of it. So you want to make sure that you're using it with legal disclaimers, copyright data, anything that would normally be considered fine print.
So if you remember that, used in the right context, it's another element that can help us add meaning to our code.
There are currently no FAQs about HTML5: Structure, Syntax, and Semantics.
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.