The next command that we will explore is the command used to center items on a web page. This command can be very useful if you want to put images or text at the top of your page, or anything for that manner, that you want centered. The good thing about the center command is that if a person is visiting your page and they have a 21” monitor set to 1024x768 pixels, with their web browser window maximized, they will still see the centered items in the center of the screen. If you did not center the items they would be at the left hand side of the screen and, if they are small, they will not be very catching to the eye. On my front web page I have everything centered. I like this because I have text then a picture then more text on the same line and if I did not center the items they would not line up correctly and make the entire page look or poor quality.
Let’s say you decide that your page would look much better with a centered banner of your favorite web browser on it. Since my favorite web browser is Netscape, I will use it in my example. Let’s say you find a nice banner that advertises the Netscape web browser and since your page looks its best with netscape you decide that you should put that banner on your page. For now we will call the banner netscape.gif. The first thing that you would do would be to enter the beginning center command. That command is an angle bracket “<“ followed by the word CENTER followed by an angle bracket “>”. Then you would enter the item that you want centered. Let’s say that you want a link to netscape through the banner so you would enter the A HREF command and the IMG SRC command. Then you would tell the browser that you do not want anything following that centered. To do this the command is a cart “<“ followed by a slash “/” followed by the word CENTER followed by an angle bracket “>”. The final source code to do this would look like this:
I had also mentioned that there was a way to center more then one item. Well instead of entering the center and uncenter command for every item that you want centered. This could be a long and tedious process. You could, if all the items that you want centered follow one another, just enter the center command once and enter the uncenter command at the end of the items that you wish to be centered. If you wanted the netscape banner and the text under it to be centered, and that the text reads “Click on the banner to download netscape”, you could do that. Of course to put the two items on two different lines you would have to insert a break command. The final source code for this document would look like this: