With the document structure of a HTML document behind us and an understanding of HTML syntax it's time to add some meat to our documents with our first look at some of the text tags available in HTML5.
The b Element
For even greater control use the CSS font-weight property.
The blockquote Element
The cite Element
The q Element
The small Element
Use the CSS font-size property if you just want to set a small font size.
Creating A Webpage
Lets create a webpage for our text tags to see what they do!
- Open up your HTML editor or text editor, which in my case is Notepad++.
- Open a document if required.
- Copy and paste the following code into the document.
<!DOCTYPE html> <!-- Introduction to Text Tags --> <html lang="en"> <head> <title> HTML Text Tags </title> </head> <body> <b>This text will be in bold type.</b> <blockquote>Blockquote text is indented and whitespaced.</blockquote> <cite>If music be the food of love play on</cite> by William Shakespeare <blockquote>Blockquote text is indented and whitespaced.</blockquote> <q>Text will be wrapped with quotation marks.</q> <blockquote>Blockquote text is indented and whitespaced.</blockquote> Money back guarantee! <small>terms & conditions apply...</small> </body> </html>
Saving the document
Save the file as
View Page in Web Browser
Either navigate to the location you saved the
texttags.htmlfile to and double click the file. This will take you to the page in your default web browser, or from your web browser click File --> Open File and navigate to the file and open it.
After doing either of these you should see a similar webpage in your browser to the following screenshot:
We used the <blockquote> tag several times just to put the HTML on different lines, there are formatting tags much more suitable for this purpose as we will find out in the next lesson.
Lesson 4 Complete
In this lesson we took out first look at some of the text tags available in HTML.
The <b> bold text tag
The <blockquote> block quotation tag
The <cite> citation tag
The <q> quotation tag
The <small> small text tag