This gets into one of those sticky NetScape versus "standard" HTML situations. NetScape introduced an HTML extensions- <center>...</center> tag- it aligns everything inside the tags with the center of the web page. Seems to make sense? Well, if you talk to a mark-up language purist, alignment is an attribute. The more general (and therefore more widely supported) HTML for center alignment is a variation on the <p> tag:
<p> blah blah blah <img src="file.gif"><br> blah blah </p>Note that now there is a closing </p> tag. Also, if you are center aligning several paragraphs, each one will have to be marked with a separate <p align=center>...</p>
Some other browsers now support NetScape's <center>...</center> tags, but not all of them. Remember that if a browser does not support a tag, it will just ignore it.
For the effect of center alignment, compare:
Cheese In HistoryCheese was been there for many major eventsWhen Magellan sailed through the narrow Straits, he was eating cheese. When the Allied troops landed in Europe, cheese was there. When Neil Armstrong stepped onto the moon, he had just had finished a cheese snack.
|
Cheese In HistoryCheese was been there for many major eventsWhen Magellan sailed through the narrow Straits, he was eating cheese. When the Allied troops landed in Europe, cheese was there. When Neil Armstrong stepped onto the moon, he had just had finished a cheese snack.
|
Now we will modify our cover page (index.htm) to use the center tag on the list of lesson sections. We will also make some other changes to improve it's appearance.
<B>In this Lesson...</B> <ul> <i> <li><A HREF="intro.htm">Introduction</A> <li><A HREF="term.htm">Volcano Terminology</A> <li><A HREF="usa.htm">Volcanic Places in the USA</A> <li><A HREF="mars.htm">Volcanic Places on Mars</A> <li><A HREF="proj.htm">Research Project</A> </i> </ul>and replace it with the following HTML:
<p align=center> <font size=+1> <i> <A HREF="intro.htm">Introduction</A><br> <A HREF="term.htm">Volcano Terminology</A><br> <A HREF="usa.htm">Volcanic Places in the USA</A><br> <A HREF="mars.htm">Volcanic Places on Mars</A><br> <A HREF="proj.htm">Research Project</A><br> </i> </font> </p>
NOTE: Look closely at the changes we have made. This whole section is enclosed in the <p align=center>..</p> tags for alignment. The unordered list we built in lesson 6 would look odd centered- the bullet marks would be staggered. So we have removed the <ul><li>...<li>...</ul> structure. The <br> tags at the end of each line will force a line break. And finally, we have added a <font>...</font> tag to increase the text size.You may want to compare your HTML file to an example of how it should look at this point.if you wish you could also use the <center>...</center> tags in place of <p align=center>...</p>
Any header <hN>...</hN> tag may be center aligned by adding the attribute:
<hN align=center>blah blah blah</hN>We will know use this to center the title of each web page:
<h2>Introduction</h2>to
<h2 align=center>Introduction</h2>
NOTE: There is also an align attribute for the <hr> tag that is relevant to the other options we reviewed in lesson 19 "Easy Hard Rules". When you specify a shorter width for a hard rule, you can also specify that it be aligned to the left or the right (the default is to center align hard rule lines):<hr size=8 width=60% align=right>will produce:
while using left alignment<hr size=8 width=60% align=left>produces:
With the align attribute to the <img> tag be can now specify to have the image itself aligned to the right or left margin of the page. But more so, we can have any HTML following it "fill" in around the empty space. The HTML to do this is:
<img src="filename.gif" align=right> <img src="filename.gif" align=left>Compare these two examples:
no align attribute or align=bottom |
---|
Cheese In HistoryCheese was been there for many major eventsWhen Magellan sailed through the narrow Straits, he was eating cheese. When the Allied troops landed in Europe, cheese was there. When Neil Armstrong stepped onto the moon, he had just had finished a cheese snack.
|
align=left |
Cheese In HistoryCheese was been there for many major eventsWhen Magellan sailed through the narrow Straits, he was eating cheese. When the Allied troops landed in Europe, cheese was there. When Neil Armstrong stepped onto the moon, he had just had finished a cheese snack. |
Shrink and stretch your web browser window to see how it affects your page with aligned images/text.
One more note. There will be times when the text or other items that are aligned with the image are rather short and you want to force the next text to jump down below the image. There is an attribute for the
tag to clear the alignment:
<br clear=left> <br clear=right> <br clear=all>that will "clear" any preceding alignments set up in the <img> tags. We suggest that you always use these tags because the alignment will vary depending on the font specified in the reader's web browser and the width of their browser window.
We will now return to our index.htm page to re-format the opening screen. The picture may look nice, but it takes more vertical space to have the picture followed by the text below. We will use the image/text alignment to put some of the text adjacent to the image.
<img alt="A Lesson on:" src="../pictures/lava.gif"> <p> <B><font size=+4 color=#FF66FF>V</font> <font size=+3 color=#DD0055>OLCANO WEB</font></B> <BLOCKQUOTE> <B><I><font size=+1>"Nature raves savagely, threatening the lands"</font></I></B><br> -- Pliny the Elder, who died of asphyxiation after observing the destruction of Pompeii by the 79 A.D. eruption of Mount Vesuvius. </BLOCKQUOTE> In this lesson you will use the Internet to research information on volcanoes and then write a report on your results.and replace it with:
<img alt="A Lesson on:" src="../pictures/lava.gif" align=left> <B><I><font size=+1> "Nature raves savagely, threatening the lands" </font></I></B><br> -- Pliny the Elder, who died of asphyxiation after observing the destruction of Pompeii by the 79 A.D. eruption of Mount Vesuvius. <p> <B><font size=+4 color=#FF66FF>V</font> <font size=+3 color=#DD0055>OLCANO WEB</font></B> <p> In this lesson you will use the Internet to research information on volcanoes and then write a report on your results. <br clear=left>
NOTE: Everything between the <img... align=left> tag and the <br clear=left> tag will be placed adjacent to the picture- the image is aligned left and the other HTML fills the empty space.You may want to compare your HTML file to an example of how it should look at this point.We also put the quotation at the top to attract attention. With this new layout, the <blockquote> tag is not effective, so it was removed.
<div align=left>...</div> <div align=right>...</div> <div align=center>...</div>Note that the center attribute accomplishes the same effect as the NetScape <center>...</center> tag.
We will now use this tag to make the opening quotation on our cover page have its text aligned to the right margin of the page:
<div align=right> <B><I><font size=+1> "Nature raves savagely, threatening the lands" </font></I></B><br> -- Pliny the Elder, who died of asphyxiation after observing the destruction of Pompeii by the 79 A.D. eruption of Mount Vesuvius. <p> <B><font size=+4 color=#FF66FF>V</font> <font size=+3 color=#DD0055>OLCANO WEB</font></B> </div>
Let's set up a pretty table... |
The Internet Connection at MCLI is
Alan Levine --}
Comments to levine@maricopa.edu
URL: http://www.mcli.dist.maricopa.edu/tut/tut20.htm