Tuesday, July 18, 2017

HTML 5 Tutorial Part 2 - Basics of HTML - Text Elements

So, we have learned about the basics of html5 in the Part 1 of the series of tutorials. In this part we will discuss different Text elements and their attributes.

Note: No examples included please try them in an HTML page and see for yourself that what would be the text like. This is done intentionally. Purpose is to make you aware of the elements and encourage to try them yourself.

Block vs Inline Elements

Block elements are used to define a block of content like div or p tag. They are rendered on different lines, we can make them render on the same line using css. But we can say that block element render in the next line.

Inline elements are used to defined links or acronyms like span tag, a tag. Text will be rendered inline to the content. 


H1 - Primary heading

Primary heading of the document. It is also used by the search engines. 

H2-H6 - Sub headings

HTML have subheadings ranging from H2 - H6. So you can have subheading H2, H3, H4, H5 and H6. You want to use one primary heading for your page and subsequent sub headings. 

Note: We do not want to use the heading for the font size, we can style the text using style sheets.


When client sees the pre tag it will honor the whitespace in the content.


Used to add the newline.


Adding a horizonal rule and you can style it look different way.

&nbsp - non breaking space

This is instruction to client that do not break a line at that point while doing text wrapping.

&lt and &gt

Used to show the less than and greater than signs in the web page. As we have < and > being used in the html and if you want to show those as symbols than we need to use &lt and &gt.

<sup> and <sub>

superscript and subscript used to set the text as superscript and subscript.


Information for citing a particular person or entity. It will be rendered as Italic text. you can style the cite in the styles. These are mostly for the search engines.

<abbr> and <acronym>

acronym is used to put the acronym and set the title attribute to set the full name of the acronym. Full name of the acronym will be shown in the mouse hover tooltip. abbr is used in the same way.

<em> and <strong>

emphasis and strong can be used to highlight the text. em is going to render the text in italic and strong is going to make the fond bold.


blockquoute and qoute are used to put some quoutes in the text. Blockqoute as the names suggest is block element and q is inline qoute.

Note: Please try them at home.

No comments:

Post a Comment