So here is the lesson you all have been waiting for, whether you know it or not :-) Up until now, your pages have been pretty basic, but now we will talk about ways to affect the layout of your page. So lets get started with some of the basics.
The paragraph tag <P></P>, as the name suggest, should be used to identify a paragraph. The closing tag is optional, but
should be used to help alleviate any possible bugs in a browser. You can also use the ALIGN attribute with paragraphs to suggest the horizontal alignment for the content of the paragraph on
visual browsers. Possible values are left, right, center, and justify. The tag would look something like this:
<P ALIGN="left">Your paragraph here</P>
HTML does not specify a presentation for the P element. Visual browsers commonly use block paragraphs with no first-line indent and separated by a blank line.
As you may or may not have noticed, your browser probably automatically wraps the text as you resize the browser window. (Wrapping is when the text slides down to the next line as you change the window size.)This is great for 99% of the time, but what if you have two words that must be kept together? This is where the non-breaking space can be used. A non-breaking space is used to treat two words as one for word wrapping. The tag looks like this: So if you wanted to use it to keep two words on the same line, you would do something like this:
Dear Aunt Sue,
And it would show up in your browser looking like this:
Dear Aunt Sue,
There are really only two specialized tags for alignment, the CENTER tag, and the DIV tag. The CENTER tag is the most commonly used, and most recognized by different browsers. The DIV tag allows for many different options, but it is only recognized by the newer browsers. When you use either of these tags, you must use the closing tag as well.
The CENTER tag is used to center anything in between the opening and closing tags. You would use the tags in the following manner:
<CENTER>Whatever you wanted centered</CENTER>
The center tag can be used on almost any of the HTML tags. This includes (but is not limited to) the image, headers, and table tags. In fact, there is very few, if any, tags that I can think of
that can not be placed inside the CENTER tags. The DIV tag, which I think stands for DIVision, is what is referred to as a generic block-level container. You can use it to add style or language information to any block (or piece) of content. DIV tags are best used with the ID, CLASS, LANG and ALIGN attributes. We are just going to look at the ALIGN attribute, but you can look at the HTML 4.0 Help files that I had you download in lesson 1 for more information. You can use a value of left, right, justify, and center for values of the ALIGN attribute, with <DIV ALIGN="center">Items or text to be centered</DIV> being the equivilant of the CENTER tag used above.
NOTE: The majority of these tags are "depreciated" in favor of style sheets. Depreciated simply means that there are other methods of accomplishing the same task that are preferred. Depreciated features may become obsolete in future versions of HTML, though browsers that support the features will likely continue to support them. More information about style sheets can be found at Style Sheets Now!, a site hosed be the W3C. If you are truly interested in creating HTML documents, I highly suggest you take some time and look into using style sheets.
When you are ready, we can continue with lesson 7 - tables.