Basic HTML Codes for Beginners

by Tammy

Basic HTML Codes for Beginners

Learning HTML isn’t just for websites anymore. You can also use it on forums and blogs. Look through the list below for a few basic codes that will get you going fast and easy.

To test the codes, open a program like Notepad and try out all of the codes there. Save the file with a .htm or .html extension (i.e., sample.html), then open it in your favorite web browser.

Bold, Underlined, and Italicized

Some of the easiest codes in HTML are those like making text bold, underlining a word, or adding emphasis with italics. All <HTML> codes are enclosed within less than and greater than brackets, and they always end with a closing slash </HTML> that tells browsers to end the code.

For text to appear in bold, you would type <strong> and end with </strong>. The word(s) you want to be in bold would be inserted between the codes. See example below.

<strong>This is bold.</strong>

Which would look like:

This is bold.

This same technique can be used for underlining or italicizing a word.

<u>Underlined</u> would be Underlined.

<em>Italicized</em> would be Italicized.

Center Align and Right Justify

Some web designers prefer not to use the older center tag, but for an easily remembered way of centering text (or a sentence or page), simply use <center>, then close it with </center> after you have typed whatever you want to be centered.

<center>Centered Text</center> looks like:

Centered Text

Another way to center words in HTML is to use the more accepted CSS P Align code, which will also allow you to right justify your words. To do this, replace the simple <center> tag with <p align="center"> and close with </p>.

<p align="center">More Centered Text</p>:

More Centered Text

There might be times when you want to align your words to the right, such as for a copyright notice at the bottom of a web page. You can accomplish this by exchanging the word "center" with "right" in your P Align code.

<p align="right">What else can HTML do?</p> would be:

What else can HTML do?

Enter and Double Space

Normally, when you are typing and you’d like to end a sentence and go to the next line, you would simply hit the Enter key on your computer’s keyboard. This doesn’t work in HTML. In order to break and jump to the next line, you will need to use the <br> code at the end of your sentence.

Example: Without the <br> tag after the word example, everything typed remains on the same line.

However, written like this, it’s like clicking the Enter key.

Double spacing between sentences also doesn’t work in HTML. Mostly, it probably won’t be necessary, but if you ever have a need to add an extra space, type &nbsp; wherever you want to include an additional space.

If you are using the <br> tag in XHTML, it will need to be closed. In that case, you would add a slash to the code: </br>

More on BR and Paragraph Tags

While on the subject of spacing, you’ll find that the <br> tag alone isn’t enough to create a space between paragraphs. For this, you can use the paragraph code, which is similar to the P Align tag mentioned above, by simply putting each individual paragraph between the <p> and </p> tags, or you can double the BR tag between paragraphs, such as <br><br>.

Obviously, these are only a few codes to help beginners in getting started with HTML. There are so many other things you can do, such as how to create a link or a table, as well as inserting images and learning how to write meta tags for your website.

So, when you have these down, keep learning more. Before you know it, HTML will become second nature to you.