|
|||||
|
|||||
HTML Primer IIFormatting TextAll text formatting takes place within the BODY tags. With the advent of newer releases of HTML (HTML 3.2, for example) by the World Wide Web Consortium (w3), there are now faster ways of formatting pages called style sheets. But these can get rather complicated. Let's stick to the basics. You've already seen how to format bold and italics.
heading text
heading text
heading textand so forth until H6, which is thesmallest headingYou can also increase and decrease the size of the font you use. This is accomplished with the <FONT></FONT> tags. For example, to format text in standard size font, usually 12 point on a word processing program:
You may want to break your line, so it doesn't run to the edge of the screen and wrap around. For that, you use the <BR> tag. Place it where you want a line break. You can also use this to space text. Once you finish with a paragraph, you can put a <BR>, and the browser will skip a line. Note: there is no </BR>. The paragraphs in this document, though, are separated using the handy <P> tag. Simply put this at the beginning of a line or paragraph, and it will be separated from the previous line by a single space. Finally, there is the non-breaking space tag. This is useful for putting space under images. The code there begins with an ampersand and ends with a semicolon: & nbsp; But don't put the space in. (I can't display the code since your browser will interpret it as a space!) You can use an ampersand in your text as long as it has a space on either side of it. Otherwise, a browser may confuse it for a tag. There are a number of characters you have to keep out of your text. A less-than sign, <, is an & plus lt. A greater-than sign, >, is an & plus gt. If you would like to get a list of these codes, go to your favorite search engine and look up "ISO character set." If you want to align your text, use the <DIV ALIGN> </DIV> tags. For example, let's say you want your text to be centered on the page. You would tag it: <DIV ALIGN=CENTER> text </DIV>. You can also ALIGN=LEFT and ALIGN=RIGHT. You can use these tags to align one word, a paragraph, or the whole page.
Formatting Text Blocks and Images: TablesNow that you know how to organize a text, it's time to learn how to organize text blocks. What this means is simply that you need to know how to arrange a page so that you have sufficient margins and adequate line width. The most common way of doing this is to produce a table. A table is an area of the browser's screen that you delimit. Like accounting tables, an HTML table has columns and rows. For those of you (like me) who always had a difficult time keeping these two straight, just remember that Greek columns support ceilings, and that when you row a boat, you row along the horizon. Therefore, a column is the verticle on your screen, a row the horizontal. A table is created with the <TABLE></TABLE> tags. Most importantly, you can align your table to the left margin, the center, or the right margin. The table which organizes the text on this page is aligned in the center of the page. You can also tell the browser how much of the screen you'd like to use: 100%, 90%, 83%, and so forth. You choose the amount. We'll get to that in a second. The simple rule of tables is that a table needs a minimum of two elements, or cells. If the browser only sees one cell, it wonders why you want a table at all and defaults to ignoring the table completely. Fortunately, there are tricks to fool a browser! Let's begin with a simple table of one row and two columns. Let's put it right here:
I've made the border of the table red and the background of each cell lime. I can choose any color for any attribute. I can even increase the width of the border or the relative size of each cell. This is how you make a table: The table is established with <TABLE>. Then you tell the browser you'd like one row: <TR>, which stands for "table row." Now the browser is ready for the first cell. It needs some data, table data or <TD>. So far, you have this:
So, let's say you want to format your text to appear with a wide margin on each side. You can write this:
To format images, simply create a table and place your image in one of the cells. You need to know the height and width of your image (see next installment, images). This is the code: <IMG SRC="image.gif" BORDER=0 WIDTH=62 HEIGHT=253>. For more, click below.
|