An introductory guide to learning basic HTML tags, including framework tags, text decoration and formatting, media embedding, lists, and tables.
Learning HTML code begins with learning the basic tags. By studying the examples in this article, you will learn all of the basic HTML tags needed to create a simple webpage.
First of all, it is important to know that almost every tag has an opening and a closing. When this occurs, we open with <tag> and close with </tag>. Some tags do not open and close. These are simply inserted as <tag> and are never closed (though in the XHTML standard, they would be typed as <tag/>). In the following examples, tags with no slashes denote that they must be opened and closed, while tags with a slash after the content (<tag/>) only need to be inserted and are never closed.
Note: "<tag>" is not a real tag.
Also, attributes are pieces of information placed inside a tag. For instance, to use a tag's color attribute, we would write: <tag color="COLORINFO"></tag>, where COLORINFO is replaced with the appropriate value, and the whole tag is closed with a simple </tag> (not </tag color="COLORINFO">).
FRAMEWORK TAGS -- These tags comprise the basic framework for any webpage.
- <html> This tag occurs at the beginning of any HTML page. It is part of the basic framework of any page.
- <head> This tag comes after <html> and defines the head of your document, where you place information that you do not want to appear directly on your webpage. Here you can include information such as the title, meta tags, and CSS.
- <title> This tag denotes the title and belongs between the <head> tags. The words you want on the browser's title bar should be placed between the <title> and </title> tags.
- <body> This tag opens the body of your webpage, where most of the content is entered. It has two important attributes: "background" and "bgcolor". A background value must be the URL of an image (to create a background image), and a bgcolor value must be a color name or a hexadecimal format (e.g., "gray" or #FF55AA).
All of the aforementioned tags are necessary for the framework of your webpage (except for the title, though it is considered standard). This is what the framework of any HTML code should look like:
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
The words, pictures, and tables that you want on your webpage should fall between the <body> tags. Later in this article, I will show the source code for a very simple webpage.
TEXT DECORATION -- The following tags are the basic tags used to decorate text.
- <b> This tag makes text bold.
- <i> This tag makes text italicized.
- <u> This tag makes text underlined.
- <big> This tag makes text larger.
These tags can be used separately or in conjunction to create more effects. For example: This text is emphasized, while this text is intense!
- <font> Other text effects can be achieved using the <font> tag. The important attributes here are "color", "size", and "face". Color values must be in word or hexadecimal format (e.g., "fuchsia" or #BB6677), size values must be a number from one through seven (seven being the largest), and face values can be the name of any font.
Ex: <font color="green" size="2" face="Georgia">This text is altered.</font>
This text is altered.
EXAMPLE WEBPAGE CODE
The code for an example webpage could look like this:
<html>
<head>
<title>Example Webpage!</title>
</head>
<body bgcolor="#AABB33">
<b>This text is bold!</b>
This text is not bold. Nor is it formatted in any other way.
</body>
</html>
TEXT FORMATTING -- The following tags are the basic tags used to format text.
- <br/> This tag creates a break in the text. Pressing "enter" in your HTML editor will not create an actual break on the page, so you must use this tag to create line breaks.
- <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <h7> These tags are the header tags. <h1> creates the largest header, while <h7> creates the smallest header. A header consists of size-altered text with line breaks above and below.
- <p> The paragraph tag creates a line break before and after a paragraph of text.
INSERTING MEDIA -- The following tags are used to insert various media.
- <img/> The image tag inserts an image. It has one necessary attribute, "src". The value for "src" must be the URL of an image.
Ex: <img src="https://image.howtodotips.net/howtodo/htdt/computers-internet/programming/how_to_learn_html_code_tags_0.jpg"> - <a> The anchor tag inserts a hyperlink. It also has a necessary attribute -- "href". The value for "href" must be the URL of the website (or image, or file, etc.) to which you want to link.
Ex: <a href="http://www.link.org">This website is great!</a>
CREATING LISTS -- The following tags are used to create lists.
All lists are made using a main opening tag (<bl>, <ul>, or <ol>), which must be closed after the list is finished, and list item tags (<li>), which must be closed after each individual list item.
- <ul> The unordered list tag creates a list marked by small black circles. The "type" attribute can have values of "disc", "circle", or "square", which change the small black circles into other markers.
Note: <bl> (bulleted list) is the same as <ul>, except that the list is pulled to the left (usually not preferred). - <ol> The ordered list tag creates a list marked by numbers. The value for the "start" attribute can be any number, telling the list where to begin numbering. The value for the "type" attribute can be A, a, I, i, or 1, which tells the list what type of numbering to use (alphabetical, numerical, or Roman numerals).
TABLES -- The following tags are used to create tables.
Tables are the most advanced topic covered in basic HTML.
- <table> The table tag signifies the beginning of a table. Possible attributes are "bgcolor", "border", "cellpadding", "cellspacing", "width", "align", or "valign".
- The value for the "bgcolor" attribute is a color in hexadecimal format (e.g., #33AA44).
- The value for the "border" attribute is a number that denotes the thickness of the border.
- The value for the "cellpadding" attribute is a number that denotes the distance (in pixels) between the border and the contents of the table.
- The value for the "cellspacing" attribute is a number that denotes how wide the border will be.
- The value for the "width" attribute is a number that denotes how wide the table will be (in pixels).
- The value for the "align" attribute must be "left", "right", or "center", and denotes where the content of the table aligns.
- The value for the "valign" attribute must be "top", "bottom", or "middle", and denotes where the content of the table aligns vertically.
- <tr> This tag defines a table row. You must create it before creating a <td>. You always define rows before defining cells in those rows (which create columns). You can use the "height" attribute here by giving it a value in pixels to define the height of the row. You can also use a percentage (e.g., "30%") to define how much of the page it will take up vertically, but this is not recommended for table rows.
- <td> This tag defines a table cell. Information can be placed inside a table cell, while <tr> and <td> used in conjunction define what a table will look like. You can use the "width" attribute here to define, in pixels, how wide the cell will be. You can also use a percentage (e.g., "55%") to define how much of the page it will take up horizontally.
Here is an example of code that could create a table:
<table>
<tr>
<td>This is the first row, first column!</td>
<td>This is the first row, second column!</td>
</tr>
<tr>
<td>This is the second row, first column!</td>
<td>This is the second row, second column!</td>
</tr>
</table>
You can copy this code into your own HTML editor to see what the finished product looks like. Feel free to tinker with it by adding more rows, an unequal amount of table cells in each row, and various attributes.
Learn HTML Code Tags
An introductory guide to learning basic HTML tags, including framework tags, text decoration and formatting, media embedding, lists, and tables.
Learning HTML code begins with learning the basic tags. By studying the examples in this article, you will learn all of the basic HTML tags needed to create a simple webpage.
First of all, it is important to know that almost every tag has an opening and a closing. When this occurs, we open with <tag> and close with </tag>. Some tags do not open and close. These are simply inserted as <tag> and are never closed (though in the XHTML standard, they would be typed as <tag/>). In the following examples, tags with no slashes denote that they must be opened and closed, while tags with a slash after the content (<tag/>) only need to be inserted and are never closed.
Note: "<tag>" is not a real tag.
Also, attributes are pieces of information placed inside a tag. For instance, to use a tag's color attribute, we would write: <tag color="COLORINFO"></tag>, where COLORINFO is replaced with the appropriate value, and the whole tag is closed with a simple </tag> (not </tag color="COLORINFO">).
FRAMEWORK TAGS -- These tags comprise the basic framework for any webpage.
- <html> This tag occurs at the beginning of any HTML page. It is part of the basic framework of any page.
- <head> This tag comes after <html> and defines the head of your document, where you place information that you do not want to appear directly on your webpage. Here you can include information such as the title, meta tags, and CSS.
- <title> This tag denotes the title and belongs between the <head> tags. The words you want on the browser's title bar should be placed between the <title> and </title> tags.
- <body> This tag opens the body of your webpage, where most of the content is entered. It has two important attributes: "background" and "bgcolor". A background value must be the URL of an image (to create a background image), and a bgcolor value must be a color name or a hexadecimal format (e.g., "gray" or #FF55AA).
All of the aforementioned tags are necessary for the framework of your webpage (except for the title, though it is considered standard). This is what the framework of any HTML code should look like:
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
The words, pictures, and tables that you want on your webpage should fall between the <body> tags. Later in this article, I will show the source code for a very simple webpage.
TEXT DECORATION -- The following tags are the basic tags used to decorate text.
- <b> This tag makes text bold.
- <i> This tag makes text italicized.
- <u> This tag makes text underlined.
- <big> This tag makes text larger.
These tags can be used separately or in conjunction to create more effects. For example: This text is emphasized, while this text is intense!
- <font> Other text effects can be achieved using the <font> tag. The important attributes here are "color", "size", and "face". Color values must be in word or hexadecimal format (e.g., "fuchsia" or #BB6677), size values must be a number from one through seven (seven being the largest), and face values can be the name of any font.
Ex: <font color="green" size="2" face="Georgia">This text is altered.</font>
This text is altered.
EXAMPLE WEBPAGE CODE
The code for an example webpage could look like this:
<html>
<head>
<title>Example Webpage!</title>
</head>
<body bgcolor="#AABB33">
<b>This text is bold!</b>
This text is not bold. Nor is it formatted in any other way.
</body>
</html>
TEXT FORMATTING -- The following tags are the basic tags used to format text.
- <br/> This tag creates a break in the text. Pressing "enter" in your HTML editor will not create an actual break on the page, so you must use this tag to create line breaks.
- <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <h7> These tags are the header tags. <h1> creates the largest header, while <h7> creates the smallest header. A header consists of size-altered text with line breaks above and below.
- <p> The paragraph tag creates a line break before and after a paragraph of text.
INSERTING MEDIA -- The following tags are used to insert various media.
- <img/> The image tag inserts an image. It has one necessary attribute, "src". The value for "src" must be the URL of an image.
Ex: <img src="https://image.howtodotips.net/howtodo/htdt/computers-internet/programming/how_to_learn_html_code_tags_0.jpg"> - <a> The anchor tag inserts a hyperlink. It also has a necessary attribute -- "href". The value for "href" must be the URL of the website (or image, or file, etc.) to which you want to link.
Ex: <a href="http://www.link.org">This website is great!</a>
CREATING LISTS -- The following tags are used to create lists.
All lists are made using a main opening tag (<bl>, <ul>, or <ol>), which must be closed after the list is finished, and list item tags (<li>), which must be closed after each individual list item.
- <ul> The unordered list tag creates a list marked by small black circles. The "type" attribute can have values of "disc", "circle", or "square", which change the small black circles into other markers.
Note: <bl> (bulleted list) is the same as <ul>, except that the list is pulled to the left (usually not preferred). - <ol> The ordered list tag creates a list marked by numbers. The value for the "start" attribute can be any number, telling the list where to begin numbering. The value for the "type" attribute can be A, a, I, i, or 1, which tells the list what type of numbering to use (alphabetical, numerical, or Roman numerals).
TABLES -- The following tags are used to create tables.
Tables are the most advanced topic covered in basic HTML.
- <table> The table tag signifies the beginning of a table. Possible attributes are "bgcolor", "border", "cellpadding", "cellspacing", "width", "align", or "valign".
- The value for the "bgcolor" attribute is a color in hexadecimal format (e.g., #33AA44).
- The value for the "border" attribute is a number that denotes the thickness of the border.
- The value for the "cellpadding" attribute is a number that denotes the distance (in pixels) between the border and the contents of the table.
- The value for the "cellspacing" attribute is a number that denotes how wide the border will be.
- The value for the "width" attribute is a number that denotes how wide the table will be (in pixels).
- The value for the "align" attribute must be "left", "right", or "center", and denotes where the content of the table aligns.
- The value for the "valign" attribute must be "top", "bottom", or "middle", and denotes where the content of the table aligns vertically.
- <tr> This tag defines a table row. You must create it before creating a <td>. You always define rows before defining cells in those rows (which create columns). You can use the "height" attribute here by giving it a value in pixels to define the height of the row. You can also use a percentage (e.g., "30%") to define how much of the page it will take up vertically, but this is not recommended for table rows.
- <td> This tag defines a table cell. Information can be placed inside a table cell, while <tr> and <td> used in conjunction define what a table will look like. You can use the "width" attribute here to define, in pixels, how wide the cell will be. You can also use a percentage (e.g., "55%") to define how much of the page it will take up horizontally.
Here is an example of code that could create a table:
<table>
<tr>
<td>This is the first row, first column!</td>
<td>This is the first row, second column!</td>
</tr>
<tr>
<td>This is the second row, first column!</td>
<td>This is the second row, second column!</td>
</tr>
</table>
You can copy this code into your own HTML editor to see what the finished product looks like. Feel free to tinker with it by adding more rows, an unequal amount of table cells in each row, and various attributes.
Learn HTML Code Tags
By Howtodotips
An introductory guide to learning basic HTML tags, including framework tags, text decoration and formatting, media embedding, lists, and tables.