| Back to Earthchronicle.com Homepage | Chronicle Subjects (Alphabetical or ECAN Codes) | I Have Something to Add! | Site Index | Reader's Guide |
| Have a Question? Ask Us! Have an update, suggestion, or found an error? Email Us! | ||||
HTML Reference Page |
|
Warning. I make no claims that this page will be useful for anyone else. I've simply gotten sick of pounding the World Wide Web looking for the same usage details on a tag that I'd looked up the week before. So I've collected all the points "I" need to remember into a reference guide here. It's handy for looking up details and attributes while you're building a page. If you're interested in learning HTML, a tutorial will probably suit you better. There are a number of good ones available on the web. I have used and recommend www.htmlgoodies.com. If you don't want a full tutorial... just some quick desgin tips, I did put all the basics for writing a webpage together. Once you're done with that there's a short tips section on how to control webpage presentation. I'm farily conservative, and I want my pages to be as widely supported as possible. So I leave out a lot of new material because it's not as widely supported as I want. Any tags eliminated in HTML 4.0 do not appear either. However, I hope it proves useful for you. With those caveats made feel free to browse.
Also, there are a few notes that will appear...
|
Table of Contents |
|||||
| <!-- --> | <!Doctype> | Anchor <a> | Attributes | <b> | |
| <base> | <basefont> | The Basics | <body> | Bold | |
| Break <br> | Comments | Definition <dd> | Definition List <dl> | Definition Term <dt> | |
| Division <div> | <!Doctype> | <font> | <frame> | Frames | |
| <frameset> | <head> | Heading <h1> | Horizontal Rules <hr> | <html> | |
| Images <img> | Italic <i> | <link> | Links | List Item <li> | |
| Lists | <meta> | <noframes> | Ordered List <ol> | Paragraphs <p> | |
| Preformatted <pre> | Controlling Presentation | <span> | Strikethrough <s> | <style> | |
| Subscript <sub> | Superscript <sup> | <table> | Table Data <td> | Table Row <tr> | |
| <title> | Typewriter Text <tt> | Underline <u> | Unordered List <ul> | White Space |
Kudos to Laura Lemay's fabulous HTML reference for assimilating browser compatibility tables with attributes. Other references will tell you <table> is HTML 3.2 Great, that sounds safe to use. But the cool bordercolordark= attribute you included means even Netscape will now balk at your "simple" table. Ooops. Lemay's tables will save you worlds of heartache and is an excellent learning guide/expert reference to boot. And everytime you see an attribute that comes with a warning... thank Laura Lemay. Lemay, Laura. Teach Yourself Web Publishing with HTML 4 in 21 Days. Professional Reference ed. Indianapolis: Sams Publishing, 1999. 1020-1070. |
Comment <!-- -->
Comments set off text you don't want to appear on the webpage but want/need anyway. TIPS: Comments are the only way to add programmers notes about changes, problems, things you want to add later. A few browsers have trouble with comments not on one line; it's a relatively minor problem, but if you can keep a comment on one line, great. They are also handy to enclose a part of your HTML. As such comments are an important diagnostic tool to find problems. You can also use it to set off HTML that you haven't finished writing yet, but I find it easier and safer to work on a copy of the page. It doesn't matter if I screw it up, (The original version is still safe.) and I can check every change I make on the fly in my browsers. It's also used to enclose a <style> tag in the header; this is how to include an embedded style sheet that is easily ignored by browsers that don't have CSS capabilities. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<!Doctype>
!Doctype indicates what kind of HTML the document is written in.
"The <!Doctype> Tag." W3
Schools. 2005 Aug. 10 <
http://www.w3schools.com/tags/tag_doctype.asp> TIPS: You can easily look up explanations for all the gunk that goes into the !Doctype in any search engine, if you really want to. The important thing to remember is that you don't need to understand it. I wasn't kidding in the syntax tag. Don't understand "why" it works. Just know that it does. Pick the one that fits your web page, copy it from below, and paste it as the first line of your HTML. This lets you use an HTML validator to confirm that your webpage is compliant. (note this doesn't mean its well-written, just that it doesn't violate the rules for 4.0 Transitional or whatever you're writing.) While you can make many decisions that create problems for your visitors, writing compliant code makes sure you don't eliminate visitors by accident. ...Now that fancy 1 MB graphic on your homepage or the ActiveX controls you added, that's your own fault. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Attributes
OK, so you need to center some text, or highlight something in magenta. You know you need align="center" or
background-color:#FF00FF. The problem is, it's not working. Turns out the tag you used doesn't take align,
or background-color, or whatever you need. What are you gonna do!?!? Well, you're in the right place. Here's
a list to "reverse engineer" the tag you need. You want to center something... here are the tags that
support it. Now you have to figure out some way to stick one of those tags in there. This may be
completely bass ackwards, unfortunately there's no solution for that problem. It may not be pretty, but
your page will be.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bold <b>
Displays text in bold. style=(Warning, only latest browsers, CSS) Sets a style sheet. TIPS: For more about font formatting see the <font> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Base>
Sets a default target and base URL that all links are are specified
relative to. href=(Safe, only problems on earliest browsers) Sets the default link address from which all relative link addresses are derived. Default is the folder the webpage is in. target=(Safe, only problems on earliest browsers) Sets the default target of links in the webpage. Targets can be redefined in the links. Can be set to a specified frame <frame name="ThisFrame">, _blank (opens a new browser), _parent (opens in the parent frame, if there's no parent, it opens in the same frame), _self (loads into the same frame as the link), _top (opens the link in the full window; ie stops using frames). _blank is even valid for pages that don't use frames, since it opens a completely new browser. Default is _self. TIPS: <Base> is used in two ways. It is one of the ways to set a default target for a webpage with frames. It also sets the base URL that all links are are specified relative to. If you need a different base address than the folder which the webpage will be in, this is how to set it. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Basefont>
(Safe, only problems on earliest browsers, Deprecated) Sets default font properties... badly. color= Sets the text color. Default is black "#000000". face= Sets the font face, e.g. Helvetica, but there is no good reference for them. Separate several faces with commas and the first font will be used unless it's unavailable. Then the second is used. If the second is not available either, the third is used, etc. Default is defined by your visitor's browser. size= Sets the size of the font on a scale from 1-7. Default is 3 (though the size varies from browser to browser). TIPS: For more about font formatting see the <font> tag. <basefont> does not display uniformly on browsers (size= is especially variable). Even though the attributes are more recent, bgcolor= and text= attributes in the <body> tag are stable across browsers AND gives you control over the background color. Or you can use <span> tags to implement CSS. These are much better options than <basefont>. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The Basics
This lays out the bare structure of an HTML document. The skeleton of an HTML document looks like this...
<html> TIPS: The <html>...</html> tags enclose the entire document and tell the browser that your web page is written in HTML. Otherwise, the visitor's browser won't know how to read it. The <head>...</head> tags enclose the HTML header which contains information that won't appear on the web page. The most important, and possibly only item in the head is the title. (Though meta tags may also appear.) The <body>...</body> tags enclose all of what will become your webpage. In addition there are several tags that are fairly fundamental to any webpage. Anytime you need to make notes or add comments about the webpage or the HTML, you will need to add a comment so the browser knows not to display the information. Comments are always critical, but especially while you are learning. The !Doctype tag is something you should add so that validation tools can check your page properly; a handy tool to make sure your page has proper syntax, especially while you're learning. And links are so fundamental to webpages that they should be considered part of the basic structure of any webpage. For more advanced features check out Controlling Presentation. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Body>
Body is one of several basic structural tags in HTML. background=(Warning, only latest browsers, Deprecated) Sets an image to be displayed in the webpage background. If the image is not the same size as a visitor's screen it will be tiled. bgcolor=(Warning, only latest browsers, Deprecated) Sets the color of the background for the webpage. Default is white. (#FFFFFF) style=(Warning, only latest browsers, CSS) Sets a style sheet. text=(Warning, only latest browsers, Deprecated) Sets the default font color for the page. You can change this anywhere you want with <font> or <span> tags. Default is black. (#000000) TIPS: HTML manuals will tell you this is the "old" way to set default colors for background and text, with a "By the way, don't do it this way. Use style sheets." which they will somehow never quite get around to teaching you. However, even bgcolor= and text= are fairly recent tags and may not be usable by some older or less common browsers. Do your best with them and hope that they simply render your page in black and white rather than crashing these browsers. There is no decent alternative to setting default font colors for the page, unless you learn to use CSS. Oh, yes. You can easily figure out how to change link colors in <body> using a google search, but I don't go into the syntax here because... well, it's psychotically stupid. There is no faster way to confuse your visitors... and to be perfectly honest, yourself. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Break <br>
Sets the end of a line. TIPS: Whatever appears after the <br> tag, is displayed on the next line down. There is no white space, between the lines however. You can even use multiple <br>s and you still don't get white space. However, if you use <br> inside the cell of a table, <td>, that's exactly what it will do; one <br> drops to the next line, two <br>s give you a line of white space, three <br>s give you two lines of white space, etc. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Definition <dd>
Sets the indented portion of a definition list, e.g. a block of text with
a left margin indented 0.5 inches. style=(Warning, only latest browsers, CSS) Sets a style sheet. TIPS: See also the sections on definition lists and unindented definition term. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Division <div>
Sets a section of text aside so it can be modified from the surrounding HTML. Works but clunky. align= Can be set to: left, center, or right. Default is left. style=(Warning, only latest browsers, CSS) Sets a style sheet. TIPS: Tables can also be used to center text or insert CSS. Tables are more flexible and give you more control over your layout than division which by default makes no change to standard HTML formatting at all. Therefore, there's nothing wrong with division, but it's been rendered almost obsolete by other tags. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Definition List <dl>
Sets the boundaries for a definition list structure. style=(Warning, only latest browsers, CSS) Sets style sheet info. TIPS: The Lists section has important basics on list use, or view the other list styles, ordered lists and unordered lists. See also the sections on the other definition list tags, indented definitions and the definition term. You don't have to follow the alternating <dt> <dd> structure that you see in most examples, you can repeat the same tag...
Note that the first example even uses a <dd> tag first which you won't find in any example. Obviously, however, it's perfectly permissible. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Definition List Term <dt>
Sets the unindented "heading" portion of a definition list. TIPS: See also the sections on definition lists and the indented definition tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Font>
Font sets... font information. You'd never have guessed. color= Sets the text color. Default is black "#000000". size= Sets the size of the font on a scale from 1-7. Default is 3 (though the size varies from browser to browser).
TIPS:
Note that <font> doesn't change much, but there are a number of associated font control tags
that together are very powerful. The critical font styles are
Bold, Italic, and
Underline.
Other font tags that are relevant are <Basefont> (which we don't recommend),
When using <font>, size is handled on an awkward 1-7 scale that displays very differently from browser to browser. I usually break down and use CSS (Cascading Style Sheets) to change font size, like the <span> tag. For color changes font is handy, though CSS can do this too. The advantage of CSS is that it's so powerful, you can set all this and more besides. The downside is that some older browsers don't handle it well, and more importantly, you have to spend a little time learning it. If you just want it done, font tags are the easiest way to do it. If you want to use CSS but don't have time to learn, get the quick and dirty scoop on how to use the span tag and you should be able to do 90% of what you want. If you want to learn CSS, you can go all the way and check out our CSS Reference. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Frame>
Describes how a particular frame looks and works. name=(Safe, only problems on earliest browsers) gives an identifying name to the frame which lets you set targets to it. noresize(Warning, only latest browsers) prohibits visitors from changing the size of the frame, otherwise they can drag the frame divider to adjust to taste. Useful for ads that visitors will want to get rid of but which you need to have up. Otherwise, it's better to leave it out, so people can adjust it to their own taste. src=(Safe, only problems on earliest browsers) Sets the webpage which loads into the frame by default. target= It's SUPPOSED to set the frame that links selected in this frame open in, but I could not get it to work at all in IE 6.0. I've given up on it and am using the target= attribute in <Base> instead. It works like a charm. TIPS: You need one <frame> tag for each frame defined in <frameset>. Just like the cells in a <Table>, The first <frame> defines the frame in the top left corner, the second the frame to its right, etc. When the first row is finished, the next <frame> specifies the far left frame of row two. The main section on Frames has a more info. The other key tags for building a page with frames are are <Frameset> and <Noframes>. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FramesThe key tags for building a page with frames are <frame>, <frameset>, and <noframes>. A frames page is difficult to put together, and may not be visible to everyone. Even current browsers can have trouble with very basic frames. So there are some important things to remember.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Frameset>
Describes the structure for the main frame page; written in HTML 4.0 Frameset. cols=(Warning, only latest browsers) Sets the number of columns and their widths. 50 sets a column 50 pixels wide, 50% sets a column which takes up half the screen,* sets a column which takes up all space leftover from the other columns. To set three columns, specify the width of each separated by commas "," (e.g. cols="50,50%,*") rows=(Warning, only latest browsers) Works just like columns above. To set three rows, specify the height of each separated by commas "," (e.g. rows="50,50%,*") APPLICATION: The main frame page is the webpage which sets the structure of the frames. Note every webpage your visitors will see are NORMAL, only the one main frame page which sets the structure of the frames uses this structure. The <body> tag is replaced by the <frameset> tag. A frame page has a different HTML skeleton from the basic structure of a normal webpage. Your HTML skeleton for the main frame page will look like...
<html> Note: The <noframes> tags define the more normal <body> structure that someone will see if their browser does not handle frames. ALWAYS include <noframes> tags. It's a simple way to make your frames site accessible to the most number of people. TIPS: The main section on Frames has a more info. The other key tags for building a page with frames are <Frame> and <Noframes>. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Heading <h1>
Displays text as a heading. (It stands out and is set apart.) align=(Deprecated) Can be set to: left, center, or right. Default is Left. TIPS: Syntax is the same for headings h2 through h6. h1 is the largest, h6 the smallest. Headings always get a little white space and you can center them in their own tag, so they're really useful. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Horizontal Rules <hr>
Creates a Horizontal Line. align= Can be set to: left, center, or right. Default is center. noshade By default, HRs have a shading scheme. The noshade attribute turns it off for a simple solid color line. size=(Deprecated) Sets the thickness of the HR in pixels. Default is 2. width=(Deprecated) Sets how long the line is. Default is 100%. (width=100 sets a line 100 pixels long.) TIPS: Horizontal rules help with white space as well as providing visual boundaries in your webpage. Play with different options; the border= attribute in <table> also creates borders. Depending how much you have in your table this can look very busy. Horizontal rules look relatively plain and simple. Depending on how you want your page to look, either is perfectly acceptable. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Italic <i>
Displays text in italics. TIPS: For more about font formatting see the <font> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Images <Img>
Allows you to insert images into your document. align= Can be set to: left or right. Text before the image will end at the top of the image. If the image is aligned to the left, then all text following the image will start at the top right corner and flow nicely down the right hand side. If aligned right, the image is to the right and text flows down the left side of the image. Default is for one line of text to appear lined up with the very bottom of an image, which looks awful. See the Aligning Images section after Tips for better options. alt= creates "Alt Text". At first when the visitor's mouse stops over the image, nothing happens. After a second or two, a yellow rectangle pops up next to the mouse cursor that says, in this case, "Pop Up Text." In text only browsers, this is all that appears in place of the picture, so you can actually be fairly descriptive or just use a couple words. Alt text disappears after a second or two, so at most you have time for a couple short sentences. Rest your mouse cursor here to see alt text in action. border=(Warning, only latest browsers) Sets the width in pixels of a black border that goes around the image. Default is zero, 0, ie no border. height=(Safe, only problems on earliest browsers) Sets the height of the image in pixels. Since pictures take longer to download than webpages, text appears first and the picture is thrown into the middle of it, causing all text to jump. Since your visitor was probably already reading it, this causes them to lose their place Indicating width and height save the space for the picture so that text is aligned properly and the image then just fills the gap. You can even stretch or compress an image, though it's better to alter the image so that you don't have to use HTML for it. Default is 0. width=(Safe, only problems on earliest browsers) Sets the width of the image in pixels. Important for the same reason as height above. You can even stretch or compress an image, though it's better to alter the image so that you don't have to use HTML for it. Default is 0.
src= Sets the path of the image which the webpage will load. TIPS: Note that there is no closing tag, just drop <img> in at the spot the image should appear. One wrinkle is that alt= picks up formatting in your HTML document. This is incredibly annoying since by this time you've untrained yourself from this. NO other part of HTML does this. Therefore, you have to write the entire alt= attribute on one line no matter how long it is. Aligning Images
Text before an image will appear above it, unaffected by the image below. If you do...
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Link>
Used to call an external CSS. href= Sets where to find an external script or CSS file for the webpage. rel= Can be set to "stylesheet" or "alternate stylesheet". See Tips for an explanation. title= Assigns a name to the style, but also controls whether visitors can use their own style settings. TIPS: For inline CSS see <span>, or for details refer to the CSS Reference page. Default styles are usually preferred because disabled or senior citizens frequently NEED special style settings to view your webpage (giant font sizes are one common change). The three styles and how to set them are...
Lemay, Laura. Teach Yourself Web Publishing with HTML 4 in 21 Days. Professional Reference ed. Indianapolis: Sams Publishing, 1999. 278. When creating the CSS file, the syntax looks like...
BODY { background-color:#000000; color:#00CC00; font-size:14pt } This sets the body of the page to a black background and green text in 14 point font. If you use a <p> tag you get red text (by default in 14 point) with a half inch left margin and the first line indented a half inch to the left. (because there's a (-) minus sign in front.) However, if you use the tag <p class=largeprint> you get 20 point font (by default in green) with normal margins. You won't find any other references to the class= attribute because it can create problems with some pretty recent browsers, but it is a really cool trick. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Links <a>
A link allows your visitor to move easily and directly to related information. href= sets a link. The text between the <a href=>...</a> tags will become the link and anyone who clicks on it will be taken to, in this case, http://www.EarthChronicle.com. Further, if EarthChronicle has an inpage link with name=Inpage2, you can make this link go directly to that point on the webpage by using, href="http://www.EarthChronicle.com#Inpage2" name= Gives this spot in the HTML document a name for an inpage link to use. See the In-Page links below. style=(Warning, only latest browsers, CSS) Sets style sheet info. target=(Safe, only problems on earliest browsers) Sets the target for the link. A default target for all links can be set using <base>. Can be set to a specified frame, on webpages with frames. <frame name="ThisFrame">. The other options are _blank (opens a new browser), _parent (opens in the parent frame, if there's no parent, it opens in the same frame), _self (loads into the same frame as the link), _top (opens the link in the full window; ie stops using the frames). _blank can even be used on non-framed pages. Default is _self. TIPS: You can set a name= and an href= attributes in the same tag if you need to. You won't see it much, since it names a link so you can link to it; in which case you probably just want to link to the final destination. There are three kinds of links...
Smith, Bud and Arthur Bebak. Creating Web Pages for Dummies. 6th ed. New York: Hungry Minds, Inc., 2002. 150-157. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Lists
Lists provide one of the most consistent ways that your information will actually appear on
your visitor's browser. APPLICATION: There are three kinds of lists...
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The list structure is written like this...
Smith, Bud, and Arthur Bebak. Creating Web Pages for Dummies. 6th ed. New York: Hungry Minds, Inc., 2002. 302. TIPS: Lists are one of the most important ways to organize information, along with Tables and Paragraphs. Definition lists are rarely needed for definitions, but it's another text formatting trick you can use. White Space in ListsThis is a trick I taught myself. Lists have no white space between list items (see the example above), and only one line of white space above and below the list. If you want white space between each list item, then make each item the sole list item in a list. You'll have a whole group of lists each giving the one line of white space you wanted between the list items.
Obviously, this trick doesn't work easily with an ordered list, unless you want each list item numbered 1. You can get around this by using the <li> attribute start=, and you can get much the same effect with a definition list, if you enter the numbers manually on the <dt> lines. For specifics on each list style see definition lists, ordered lists, and unordered lists. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
List Item <li>
Sets one item in a list.
type= For an ordered list (with numbers) using an <ol> tag: "1" gives numbers,
"a" gives lowercase alphabet, "A" gives uppercase alphabet, "i" gives lowercase Roman
numerals, "I" gives uppercase Roman numerals. TIPS: The Lists section has important basics on list use. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Meta>
Meta tags provide information about the webpage. They do not appear in your web page, itself. Dynamic Page: Loads a new page after a certain amount of time.<meta http-equiv=”refresh” content=”15; url=mypage2.html”>In this example, after about 15 seconds, the browser will automatically load the page, mypage2.html. Comments Tag: The oft abused use of meta tags, but it is handy for those search engines that still use it.<meta name=”keywords” content=”keyword, keywords, meta tag, meta tags, meta, tag, tags”><meta name=”description” content=”This is a description that may show up in a search engine when your site is a search result”> Preventing Cached Page Use: Tricks your visitor’s browser into thinking a cached page is expired and outdated. It then reloads the page from your site.<meta http-equiv=”expires” content=”Mon, 01 Jan 2005 00:00:00 GMT”>Kentie, Peter. Web Design: Tools and Techniques. 2nd edition. Berkeley, CA: Peachpit Press, 2002. 95-98. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Noframes>
Sets aside the HTML for how a frame page should appear on browsers that can't handle frames. TIPS: <Noframes> sets aside the HTML used by browsers that don't use frames... hopefully. More importantly, browsers that can handle frames know that everything between the <noframes> tags should be ignored. The <body> tags of a main frame page go inside the <noframes> tags, and the page as you want it appear without frames goes inside the <body> tags just like normal. The main section on Frames has a more info. The other key tags for building a page with frames are are <Frame> and <Frameset>. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ordered List <ol>
Sets the boundaries for a sequential list. Only items with <li> tags
are allowed in between. start=(Safe, only problems on earliest browsers) Sets the number for the first item. type=(Safe, only problems on earliest browsers) For an ordered list (with numbers) using an <ol> tag: "1" gives numbers, "a" gives lowercase alphabet, "A" gives uppercase alphabet, "i" gives lowercase Roman numerals, "I" gives uppercase Roman numerals. You can override this setting using type= in in the <li> tag. TIPS: The Lists section has important basics on list use, or view the other list styles, definition lists and unordered lists. The list item tag is the other half of building an ordered list. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Paragraphs <p>
Allows paragraph structure with the default HTML presentation rules. align=(Deprecated)Can be set to: left, center, or right. Default is Left. TIPS: Paragraphs are among the three most important organizational tools, along with Lists and Tables. Paragraphs are important because they don't break the default flow of text in HTML. If you resize a browser the text automatically moves to fit in the window, it autowraps. You can even insert a paragraph into a list or a table cell, so they're very versatile. If you use a table and want to preserve this powerful tool, do not use the width= attribute of table, or if you need to specify it as a percentage. If on the other hand, you want to disable autowrap, set width= as an absolute, e.g. pixels, inches, etc. This will force the browser to display the table cell at a certain size even it that requires scroll bars, and then you can fit your text to taste inside. More importantly, in the on going battle to make HTML give you white space, paragraphs are golden. If you don't use paragraphs, the result will typically have no white space in between. Even using <br> tags does not necessarily fix the problem since many browsers don't register multiple breaks (unless you are inside a table cell, <td>), and at the very least this causes inconsistency in the way your page appears in different browsers. A paragraph automatically inserts a line of white space before and after. (Though it's not cumulative, if you have two paragraphs next to each other there is only one line between them not two.) Many HTML programmers complain about the overuse of paragraphs, but your webpages tend to look cramped otherwise. (This is the EXACT same reason lists and tables are nice. They are also structures that give you some ability to add white space.) Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Preformatted <pre>
Displays text as typed in the HTML document. (It lifts HTML reading conventions.) TIPS: Preformatted text can be a little tricky to handle, especially if you've gotten used to the way that HTML pays no attention to your formatting, but it is useful in in certain applications. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Controlling PresentationPresentation is how you control the Style and Structure of a webpage, ie how is looks.Style is how text, images, colors, and backgrounds appear on the webpage. There are two main tools for managing the style of your webpage... Font tags, including not only <font>, but host of other tags for underlining, bold, etc. create all kinds of quick styles that are easy to use, and are widely accessible. Some tags are being phased out (marked Deprecated) and may be a problem in the future. The second is CSS (Cascading Style Sheets); you can check out our CSS reference for detailed information. These are slightly newer, and can cause problems for some of your visitors, but most people shouldn't have any real trouble with it. External style sheets are a very powerful way to control the look of your webpages, you can create one CSS file that is used by every webpage. This makes it easy to give all your webpages a consistent look, which is key to identifying your website, ie helping your visitors know when they click a link if they are at your website or if they've left. It also allows you to change the look of your website by changing one file, instead of every webpage on your site. Inline styles are the most powerful tool for customizing the look of individual pages. For information on setting inline CSS, see the <span> tag. Structure is where the text, images, etc. appear on the webpage and how they are organized. There are three main tools for webpage structure... Paragraphs <p>, are the first critical tool. They allow you to write in the standard format that your visitors are used to reading in books. It also provides some white space between paragraphs which is so important to the visual look of your page. Lists are the second tool for creating structure on your page. They are perfectly adapted for giving directions, or outlining points. While you may not typically use an outline in your regular writing, it happens a lot more in webpages where you really don't have much space to write before your visitor is having to scroll over and over again... something you want to avoid at all costs. (This is why we make copious use of inpage links to make a long page like this manageable.) Using an outline format forces you to be brief, which is exactly what you need to do in webpages. Like paragraphs, the structure it gives to a page is invaluable for helping your visitors find their way around. Tables are the most complex, but also the most powerful tool for creating structure on your webpages. A basic table is not hard to set up, and yet the world's biggest company's frequently use them to organize their most complex pages. Almost any structure you want for your website can be set with tables, they are enormously flexible. Almost all our webpages at EarthChronicle.com are organized using tables. It is a critical advantage of these structures that you can nest them inside each other or even inside themselves. e.g. You can put paragraphs, lists, or tables inside of a larger table. Another important concept to master is how to use white space in HTML. Otherwise, your page can become so overrun with text that it is difficult to locate information. Important tags for controlling white space include the break <br> (very handy when used in tables), headings, e.g. <h1>, and horizontal rules, <hr>, which provide white space and a bit of border on your pages. The most advanced presentation tag mentioned here is the image <img> tag, which adds graphics to your webpage. You need to have the image file saved on your website and know where it is located. Then use the image tag to tell your webpage where to find the file and where it goes on your webpage. (Tables are great for this.) Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Span>
Allows you to set CSS between the <body> tags of a webpage. style=(Warning, only latest browsers, CSS) Allows you to create inline CSS. TIPS: Span allows you to make inline changes to the style sheet, ie it adds style information directly to text that is enclosed by the span tag. The two other CSS techniques collect information elsewhere, embedded CSS using the <style> tags and external CSS using the <link> tag to call a *.css file. Inline CSS is also the last added which makes <span> the most powerful CSS technique; any style "rule" you set using external and embedded style sheets can be broken by applying the inline style sheet. (See our CSS Reference for more information.) Use the style= attribute to set a style element, or you can reset multiple elements. Just be sure to separate each one with a semi-colon, ";" For non-CSS font formatting see the <font> tag. These are some CSS highlights...
This is how to set bold, italic, and underline using CSS. (This meets the HTML 4.0 Strict standard.)
The syntax looks like... <span style='color:#000000;
background-color:#FFFFFF; font-size:14pt; font-weight:bold; font-style:italic;
text-decoration:underline'>Here is text spanned with this tag.</span> and here is the result... There are many tags that can also use the style= attribute. Check out our attribute tables for more information. For example, when setting margins for a paragraph, you can add the style= attribute to the <p> tag. Our citations use a paragraph tag with margins adjusted to match the MLA citation format. <p style="margin-left:0.5in; text-indent:-0.5in"> and here is the result... Lemay, Laura. Teach Yourself Web Publishing with HTML 4 in 21 Days. Professional Reference ed. Indianapolis: Sams Publishing, 1999. 1020-1070. And more text to make sure it displays on multiple lines. And more text to make sure it displays on multiple lines. And more text to make sure it displays on multiple lines. And more text to make sure it displays on multiple lines. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Strikethrough <s>
Displays text in TIPS: For more about font formatting see the <font> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Style>
Applies embedded CSS to a webpage. TIPS: Allows you to create embedded CSS. One of the reasons CSS can cause problems, is that this tag requires a type= attribute that Netscape doesn't like very much. A better choice may be an external style sheet by using the <link> tag, and the easier technique is inline CSS using the <span> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subscript <sub>
Displays text in subscript. (It appears lower on the line.) TIPS: For more about font formatting see the <font> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Superscript <sup>
Displays text in superscript. (It appears higher on the line.) TIPS: For more about font formatting see the <font> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Table>
Sets a table structure for a table of data, or for an entire webpage. align= Can be set to: left, center, or right. Sets the alignment for where the table appears on the page. Default is left. background=(Warning, only latest browsers) Sets a image for the background of the table, as much of it will be displayed as possible, or if the image is smaller it will be tiled. If you set background= and bgcolor=, background wins. You'll see the image as the background, however, using bgcolor= for the table row <tr>, or data cell <td>, will override backround for that row or cell. bgcolor=(Warning, only latest browsers) Sets the color of the background for the table. Default is white. (#FFFFFF) border= sets the width of the table's border in pixels. Default is 0, ie there's no border and the structure of the table is invisible. This is almost always best when organizing an entire page. cellpadding=(Warning, only latest browsers) sets the number of pixels between the contents of the cell and the edge of the cell. Increasing cellpadding makes the cell bigger by adding white space inside the cell. Default is 1. cellspacing=(Warning, only latest browsers) sets the number of pixels between the cells. Increasing cellspacing does not make the cell bigger, rather it adds white space between cells. Default is 2. style=(Warning, only latest browsers, CSS) Sets style sheet info. width=(Warning, only latest browsers, Netscape?) sets the width of the table across the page. It usually comes out nicest, done as a percentage. (width="100" sets a 100 pixel wide table, width="100%" sets a table that fills the width of page.) Default is either 100% or the smallest table that will fit the largest item of each column or row. TIPS: Table sets up a structure, visible or not for ANY data to appear. It can be used specifically for a standard "table"-looking set of data. However, it can also be an invisible grid that organizes where all the text and images on your page appear. As such it provides an incredibly powerful and flexible way to organize your entire web page, especially when combined with all the features below. Many of the big multinational corporate websites, with all the money in the world to spend, are still designed using tables to organize the content; they're that powerful. (As of 2005/10/04 the homepages of Microsoft, Ford, and Google, are designed using nothing more than tables to organize the page and scripts to provide visual interest.) You can place all the other tools, lists, paragraphs, etc. inside it. See the other relevant tags for <td>, table data cells, and <tr>, table rows. Tables are far and away the best tool for keeping your webpage organized. However, spacing and white space don't respond exactly the same in Netscape and Internet Explorer, so the more complicated your table, the more likely that you'll have cross-browser problems. One fairly consistent behavior is the desire to conform to the table content. If you can force the table to do what you want by changing the text that's organized inside the table structure that's the best course. If you have to, fall back on width= and height= and test everything out before you upload it to your website. If you just need vertical white space between two sections, height= responds just fine. Since this is probably the most common reason you'd need it, you should be ok. Be careful that ALL heighths and widths make sense, not just in <table>, but the <tr> tags, and the <td> tags. If there are conflicts, different browsers may adjust to them differently. (e.g. you can have problems if two cells in the same row have a different specified height, or if a <table> has width="300", but the <td> tags have widths that add up to more than that.) Tables can be nested. Just drop the nested table right into it's own cell in the larger table. This is an easy way to get borders around one part of a table. More importantly, say you've built a whole table, especially a complicated one. If suddenly you need to add something to it that doesn't fit the row and column structure, you can simply nest the odd part. This will save you from inserting (or changing) lots of colspan= attributes. It also means you can use a table to organize your entire page, and just drop an actual table into the middle of it, or drop in a table structure to have sections that have different numbers of rows and columns. This last is very difficult if you're trying to struggle with <table>, but EASY if you drop a nested table in. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Data <td>
Sets the data to go inside a cell in the table. align=(Warning, only latest browsers) Can be set to: left, center, or right. Sets where the contents appear inside the cell. Default is left. bgcolor=(Warning, only latest browsers) Sets the color of the background for the table. Default is white. (#FFFFFF) colspan=(Warning, only latest browsers) Sets how many columns the cell will take up. Default is 1. height=(Warning, only latest browsers) sets the height of the cell. (height="100" sets a 100 pixel tall cell, height="100%" sets a cell that fills the entire page.) Default is either 100% or the smallest table that will fit the largest item of each column or row. rowspan=(Warning, only latest browsers) Sets how many rows the cell will take up. Default is 1. style=(Warning, only latest browsers, CSS) Sets style sheet info. valign=(Warning, only latest browsers) Can be set to: top, middle, or bottom. Default is middle. width=(Warning, only latest browsers) sets the width of the cell across the page. It usually comes out nicest, done as a percentage. (width="100" sets a 100 pixel wide table, width="100%" sets a cell that fills the width of page.) Default is either 100% or the smallest table that will fit the largest item of each column or row. TIPS: The main <table> section has more information. See also <tr>, the table rows tag. Table cells are not controlled well with width= and height= attributes, a better choice is to adjust the content inside the cell to force the cell to take on the dimensions you want. However, for an empty cell (without content) you have almost no alternative, which makes especially height important. Width is too, but is often constrained by your columns, height for a particular row is much more flexible and can be used to create any amount of white space. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Row <tr>
Sets of the information which will appear on the same row of a table. align=(Warning, only latest browsers) Can be set to: left, center, or right. Sets where the contents appear inside the cells of the row. Default is left. bgcolor=(Warning, only latest browsers) Sets the color of the background for the table. Default is white. (#FFFFFF) style=(Warning, only latest browsers, CSS) Sets a style sheet. valign=(Warning, only latest browsers) Can be set to: top, middle, or bottom. valign= has no effect if the row is the minimum size possible. This is sneaky, since it will frequently look like there's extra room when it's the minimum white space possible. Default is middle. TIPS: The main <table> section has more information. See also <td>, the table data cells tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Title>
Title sets the text that appears in the title bar,
the top bar of the browser window. TIPS: It is one of several basic structural tags in HTML. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Typewriter Text <tt>
Displays text as monospaced, typewriter text. style=(Warning, only latest browsers, CSS) Sets style sheet info.
TIPS: For more about font formatting see the <font> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Underline <u>
Displays text underlined. style=(Warning, only latest browsers, CSS) Sets a style sheet. TIPS: For more about font formatting see the <font> tag. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unordered List <ul>
Sets the boundaries for a bulleted list. Only items with <li> tags
are allowed in between. style=(Warning, only latest browsers, CSS) Sets style sheet info. TIPS: The lists section has important basics on list use, or view the other list styles, definition lists and ordered lists. List item, <li>, is only other tag needed to build an unordered list. Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Adding White SpaceThe heading tags, e.g. <h1>, create a little white space above and below the heading. The horizontal rule tag, <hr>, creates a little white space above and below the line as well as providing a boundary between two sections of the webpage. The preformatting tag, <pre>, let's you set up text EXACTLY the way it will be displayed, so any white space you include will be there. The paragraph tag, <p>, is much maligned considering that you can use it to create a line of white space above and below just about anything. And it's such a simple tag, that even in the middle of table which gives you much more sophistacated controls, a paragraph is frequently the easiest way to insert the white space you want. The <br> tag is one means of adding white space to your document. If used by itself, all the <br> tag can do is break the end of a line and start the next line below without white space. Multiple <br> tags are ignored, just like HTML ignores multiple spaces. However, if you use <br> inside the cell of a table, <td>, that's exactly what it will do; each <br> drops to the next line, two <br>s give you a line of white space, three <br>s give you two lines of white space, etc. Lists typically have no white space between list items and only one line of white space above and below the list. However, if you want white space between each list item, then make each item the sole item in a list. For more details, see the Lists section.
Tables allow you to manually control white space, though this is not always
handled the same way in different browsers. As long as one or more tables
cells, <td>, in a row have the height you want, you can use empty cells,
<td></td>, to create white space horizontally in the row. The
colspan= attribute is nice for this, since <td colspan="6"></td> will
leave 6 blank cells in a row. They have to be adjacent however, if you wanted an
image in the third cell of the row you'd have to write... To create vertical white space in a table, ie an empty row, you only need one cell in the row and specify it's height in pixels. (e.g. <td height="100"></td>) Back to Table of Contents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Author: | chroniclemaster1 | Date Received: | 2005/09/07 |
|---|---|---|---|
| Editor: | chroniclemaster1 | First Date Posted: | 2005/09/07 |
| Proofreader: | chroniclemaster1 | Last Date Revised: | 2005/11/10 |
| Researcher(s): | chroniclemaster1 | ||
| Subjects: | |||
| Back to Earthchronicle.com Homepage | Chronicle Subjects (Alphabetical or ECAN Codes) | I Have Something to Add! | Site Index | Reader's Guide |
| Have a Question? Ask Us! Have an update, suggestion, or found an error? Email Us! | ||||