Adding Bold and Italicized Text and HTML Line Breaks

Intro to Web Design

victor rodriguez
There are times when creating a website that you need to emphasize a word or group of words. Using bold and italicized text is a great way to do this. Using a program like Microsoft word makes using bold and italicized text easy. All you have to do is click the proper icon. However, it does not work that way in HTML. I also do not recommend using already bolded or italicized text directly from Microsoft word as the program adds proprietary codes not recognized by browsers.

Suppose you wanted to type "hello" in bold text. You would have to add opening and closing bold tags. The codes would be as follows...

Hello

You may noticed that I used paragraph tags for the text. Heading tags are by default bold and therefore the extra coding would be redundant. You may also opt to use a heading tag rather than bold paragraph tag if the bolded text is a title that is separate from the main body text. Make sure to refrain from using the same heading size multiple times within your document as the world wide web consortium frowns upon it.

Another way to add emphasis or importance to text is by using italics. In a similar way to adding bold tags to text you can add italics as well. The code for italicized text is as follows...

Hello

Unlike be text tags, you can add italics to heading tags as well as paragraph tags. You can also use the codes for emphasize, blockquote, and address to italicize text as well. The tags for each are as follows...

Hello

Hello

Hello

It is important that you remember to close both bold and italics tags with the proper closing tags right after the text you want to close. Otherwise, forgetting to close a bold text tag for example would result in the entire page of text after the opening tag to be bold.

Adding a line break to text will cause the text to start a new line. It is like pressing enter in a Microsoft word document. This code does not have an open and close tag as with other HTML tags. To add a line break you would insert the code below in the place where you want the break to occur.


Or in XHTML...


XHTML is a different dialect of HTML. Most new websites are written in XHTML. One of the main features of XHTML is the automatic closing of singular tags. Rather than creating a line break with
the tag is simultaneously opened and closed. The / added directly to the code like this
.

If you want to add two sentences in a website with a single line break, the code would be written as follows...

How are you doing?
My name is Victor.

...and would appear as follows.

How are you doing?
My name is Victor.

There is no need to use a new line in the actual code. The above code is used within one single line and produces 2 lines of text. If you would like to add a double space between paragraphs or space between two lines you would add an extra line break code element to your string of code as follows...



Every line break tag you add is like pressing enter in Microsoft Word or other word-processing program. I do caution however, against using the line break tag as a way to separate text within your website for more than a few lines. It would be unwise to type a paragraph at the top of your website and then add a bunch of line breaks in order to tie it at the bottom of your website. All browsers and computers will interpret your text differently which includes interpreting the size of a pixel or size of your text. Using line breaks to separate text groups can cause text to appear in the wrong position.

Published by victor rodriguez

Hello everyone. I am the owner and Designing Manager of Victory Web Productions. I live in Guilderland, NY and am a father of a beautiful baby girl, Amy.I guess this is where I tell you a little about my h...   View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.