|
This HTML Tutorial will help you to create a simple webpage using HTML as well as provide information on several different components of HTML coding. Hopefully it will be helpful to all who encounter it. Please feel free to pass this link along to others who may be interested in teaching themselves to code in HTML but keep in mind that all content of this page is copyrighted and may not be re-published in whole or in part without express written permission.
~Gretchen L. Holcer 2008
|
Open Notepad and on a New page, paste the following. <HTML> <HEAD> <TITLE> </TITLE> </HEAD> <BODY> </BODY> </HTML> Go to File>Save As>(File type) All Files testpage.html Use the following information to define your webpage. In order to see these changes reflected, open your saved text file (testpage.html) in an Internet Explorer window, save after each change you make to the source code in notepad, and hit refresh to see the updates on your webpage. Rules of HTML All HTML Pages should begin with <HTML> and end with </HTML> The <TITLE></TITLE> section defines the text at the top of the webpage on the browser window border. The body tag defines the background color or image and all content of the webpage. All sections must have beginning and closing tags. (ie. <HEAD> </HEAD>) <HEAD></HEAD> - Between these tags is where you place any Javascript functions, metatags for search engines, and the page title. METATAGS META tags should be placed in the head of the HTML document, between the <HEAD> and </HEAD> tags (especially important in documents using FRAMES). Keywords used by search engines to index your document in addition to words from the title and document body. Typically used for synonyms and alternates of title words. E.g. <META NAME="keywords" CONTENT="oranges, lemons, limes"> Transitional effects (Try putting this in the head of your html page for a new trick! (Use both meta tags without confict!) <meta http-equiv="Page-Enter" content="revealtrans(duration=1,transition=23)"> HTML Color Names The table below provides a list of the color names that are supported by all major browsers. Note: If you want your pages to validate with an HTML or a CSS validator, W3C has listed 16 color names that you can use: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. If you want to use other colors, you must specify their RGB or HEX value. Color Name Color HEX AliceBlue #F0F8FF AntiqueWhite #FAEBD7 Aqua #00FFFF Aquamarine #7FFFD4 Azure #F0FFFF Beige #F5F5DC Bisque #FFE4C4 Black #000000 BlanchedAlmond #FFEBCD Blue #0000FF BlueViolet #8A2BE2 Brown #A52A2A BurlyWood #DEB887 CadetBlue #5F9EA0 Chartreuse #7FFF00 Chocolate #D2691E Coral #FF7F50 CornflowerBlue #6495ED Cornsilk #FFF8DC Crimson #DC143C Cyan #00FFFF DarkBlue #00008B DarkCyan #008B8B DarkGoldenRod #B8860B DarkGray #A9A9A9 DarkGrey #A9A9A9 DarkGreen #006400 DarkKhaki #BDB76B DarkMagenta #8B008B DarkOliveGreen #556B2F Darkorange #FF8C00 DarkOrchid #9932CC DarkRed #8B0000 DarkSalmon #E9967A DarkSeaGreen #8FBC8F DarkSlateBlue #483D8B DarkSlateGray #2F4F4F DarkSlateGrey #2F4F4F DarkTurquoise #00CED1 DarkViolet #9400D3 DeepPink #FF1493 DeepSkyBlue #00BFFF DimGray #696969 DimGrey #696969 DodgerBlue #1E90FF FireBrick #B22222 FloralWhite #FFFAF0 ForestGreen #228B22 Fuchsia #FF00FF Gainsboro #DCDCDC GhostWhite #F8F8FF Gold #FFD700 GoldenRod #DAA520 Gray #808080 Grey #808080 Green #008000 GreenYellow #ADFF2F HoneyDew #F0FFF0 HotPink #FF69B4 IndianRed #CD5C5C Indigo #4B0082 Ivory #FFFFF0 Khaki #F0E68C Lavender #E6E6FA LavenderBlush #FFF0F5 LawnGreen #7CFC00 LemonChiffon #FFFACD LightBlue #ADD8E6 LightCoral #F08080 LightCyan #E0FFFF LightGoldenRodYellow #FAFAD2 LightGray #D3D3D3 LightGrey #D3D3D3 LightGreen #90EE90 LightPink #FFB6C1 LightSalmon #FFA07A LightSeaGreen #20B2AA LightSkyBlue #87CEFA LightSlateGray #778899 LightSlateGrey #778899 LightSteelBlue #B0C4DE LightYellow #FFFFE0 Lime #00FF00 LimeGreen #32CD32 Linen #FAF0E6 Magenta #FF00FF Maroon #800000 MediumAquaMarine #66CDAA MediumBlue #0000CD MediumOrchid #BA55D3 MediumPurple #9370D8 MediumSeaGreen #3CB371 MediumSlateBlue #7B68EE MediumSpringGreen #00FA9A MediumTurquoise #48D1CC MediumVioletRed #C71585 MidnightBlue #191970 MintCream #F5FFFA MistyRose #FFE4E1 Moccasin #FFE4B5 NavajoWhite #FFDEAD Navy #000080 OldLace #FDF5E6 Olive #808000 OliveDrab #6B8E23 Orange #FFA500 OrangeRed #FF4500 Orchid #DA70D6 PaleGoldenRod #EEE8AA PaleGreen #98FB98 PaleTurquoise #AFEEEE PaleVioletRed #D87093 PapayaWhip #FFEFD5 PeachPuff #FFDAB9 Peru #CD853F Pink #FFC0CB Plum #DDA0DD PowderBlue #B0E0E6 Purple #800080 Red #FF0000 RosyBrown #BC8F8F RoyalBlue #4169E1 SaddleBrown #8B4513 Salmon #FA8072 SandyBrown #F4A460 SeaGreen #2E8B57 SeaShell #FFF5EE Sienna #A0522D Silver #C0C0C0 SkyBlue #87CEEB SlateBlue #6A5ACD SlateGray #708090 SlateGrey #708090 Snow #FFFAFA SpringGreen #00FF7F SteelBlue #4682B4 Tan #D2B48C Teal #008080 Thistle #D8BFD8 Tomato #FF6347 Turquoise #40E0D0 Violet #EE82EE Wheat #F5DEB3 White #FFFFFF WhiteSmoke #F5F5F5 Yellow #FFFF00 YellowGreen #9ACD32 Background Color/Image, pre-defined text color, pre-defined link attributes: <BODY></BODY> - Defines your page appearance. (Within these tags is where you will place any text, images, and links to be visible to the end user.) <BODY BGCOLOR = color> (If using color name, simply type in the name of the color. If using Color Hex values, you must use "" around the Color Hex value in your code. ie. <body bgcolor=aliceblue> OR <body bgcolor="#F0F8FF"> <BODY BACKGROUND = "replace this text with the URL of the image that you want to use for your page background"> <BODY TEXT = color> - defines the text color of any text on the page (with the exception of text included inside of tables) <BODY LINK = color> - defines the color of links on the page. <BODY ALINK = color> - defines the color of active links (when a link is clicked on) <BODY VLINK = color> - defines the color of visited links (the color the link will be after a person has clicked it and it is no longer active) All of the information to be included in the <BODY> tag can be combined as shown below: <BODY BACKGROUND ="http://www.dwdtek.com/DW1Boutique/boutiquebg.jpg" TEXT="#be7aff" LINK="#000000" ALINK="#00FF00" VLINK="#006666"> Spacing <h1>This is the largest header</h1> <h2>This is a larger header</h2> <h3>This is a large header</h3> <h4>This is a small header</h4> <h5>This is a smaller header</h5> <h6>This is the smallest header</h6> <p>The content in here is all part of one paragraph.</p> (Also good for making larger line breaks) <br>This creates a line break within a paragraph or header <PRE>This is used for preformatted text.</PRE> <center>Centers the text</center> <blockquote>Indents the text</blockquote> <hr>This creates a horizontal rule across your page. FORMATTING <b>This text will be bold</b> <strong>This text is given weight, normally by being bold.</strong> <i>This text will be in italics.</i> <em>This text will be emphasized, normally by being in italics.</em> <u>This text will be underlined. But people will think it’s a link.</u> SPECIAL CHARACTERS Non-breaking space: or   é: é or é ©: © FONTS Text on your page may be defined in font face, color, and size. Example. <font size = 1> (this number can be changed from 1 at the smallest to 7 at the largest) Font Face may also be defined in the <font> tag. Here are some examples of how this is accomplished. Font Name HTML Example ABLib BT <font face="ABLib BT">...</font> Amazone BT <font face="Amazone BT">...</font> Americana <font face="Americana">...</font> Arial <font face="Arial">...</font> Arial Black <font face="Arial Black">...</font> Bookman Old Style <font face="Bookman Old Style">...</font> Broadway BT <font face="Broadway BT">...</font> Brush Script MT <font face="Brush Script MT">...</font> Chicago <font face="Chicago">...</font> Comic Sans MS <font face="Comic Sans MS">...</font> Courier <font face="Courier">...</font> Courier New <font face="Courier New">...</font> Helvetica <font face="Helvetica">...</font> Lithos Black <font face="Lithos Black">...</font> Modern <font face="Modern">...</font> MS Sans Serif <font face="MS Sans Serif">...</font> MS Serif <font face="MS Serif">...</font> MS-DOS CP 932 <font face="MS-DOS CP 932">...</font> New Century <font face="New Century">...</font> Park Avenue BT <font face="Park Avenue BT">...</font> Roman <font face="Roman">...</font> Script <font face="Script">...</font> Small Fonts <font face="Small Fonts">Small Fonts...</font> Swiss <font face="Swiss">...</font> Symbol <font face="Symbol">Symbol...</font> Times Roman <font face="Times Roman">...</font> Times New Roman <font face="Times New Roman">...</font> Wide Latin <font face="Wide Latin">...</font>3 Wing Dings <font face="WingDings">WingDings...</font> Font color can also be defined in the <font> tag. Example. <font color=red>Red</font> All of these features may be combined as shown below. <font face="Park Avenue BT" size=6 color="#F0FFFF">Test this</font> LINKS How to create a link to another page. Example. <a href="http://www.imvu.com>IMVU</a> Here's What's Happening : A stands for Anchor. It begins the link to another page. HREF stands for Hypertext REFerence. That's a nice, short way of saying to the browser, "This is where the link is going to go." http://www.imvu.com is the FULL ADDRESS of the link. Also notice that the address has an equal sign in front of it and is enclosed in quotes. Why? Because it's an attribute of the Anchor tag, a command inside of a command. Where it reads "IMVU" is where you write the text you want to appear on the page. What is in that space will appear on the page for the viewer to click. So, write something that denotes the link. /A ends the entire link command. To instruct the browser to open a page in a new window, simply add the following to the link tag: target="new" Example. <a href="http://www.imveu.com" target="new">IMVU</a> In order for your link to have a mouseover effect (that little line of text that hovers over a link when you put your mouse over it), add the following to the link tag: title="IMVU.com 3D Avatar Chat!" Example. <a href="http://www.imveu.com" target="new" title="IMVU.com 3D Avatar Chat!">IMVU</a> IMAGES The Image Tag and the Src Attribute In HTML, images are defined with the <img> tag. The <img> tag is empty, which means that it contains attributes only and it has no closing tag. To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display on your page. The syntax of defining an image: <img src="url"> The URL points to the location where the image is stored. An image named "boat.gif" located in the directory "images" on "www.w3schools.com" has the URL: http://www.w3schools.com/images/boat.gif. The browser puts the image where the image tag occurs in the document. If you put an image tag between two paragraphs, the browser shows the first paragraph, then the image, and then the second paragraph. The Alt Attribute The alt attribute is used to define an "alternate text" for an image. The value of the alt attribute is an author-defined text: <img src="boat.gif" alt="Big Boat"> The "alt" attribute tells the reader what he or she is missing on a page if the browser can't load images. The browser will then display the alternate text instead of the image. It is a good practice to include the "alt" attribute for each image on a page, to improve the display and usefulness of your document for people who have text-only browsers. LINKING WITH IMAGES In order to create a link that utilizes an image (as in a button link that is actually a jpeg image embedded in the html page) to link to another page rather than using a simple text link, this is the proper format: <a href="LINK URL"><img src="IMAGE URL" border=0 alt="LINK TITLE"></a> Notice the addition of border=0 in this tag. This removes the link border from around the image being used as a link. If you want the image to have a border, you can define both the border size and the color (bordercolor=) in this section of the tag. TABLES Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). The letters td stands for "table data," which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc. Example. <table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table> Tables and the Border Attribute If you do not specify a border attribute the table will be displayed without any borders. Sometimes this can be useful, but most of the time, you want the borders to show. To display a table with borders, you will have to use the border attribute: <table border="1"> <tr> <td>Row 1, cell 1</td> <td>Row 1, cell 2</td> </tr> </table> You can also define a color for your table border: <table border="1" bordercolor=orange> <tr> <td>Row 1, cell 1</td> <td>Row 1, cell 2</td> </tr> </table> Headings in a Table Headings in a table are defined with the <th> tag. <table border="1"> <tr> <th>Heading</th> <th>Another Heading</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table> Empty Cells in a Table Table cells with no content are not displayed very well in most browsers. <table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td></td> </tr> </table> Note that the borders around the empty table cell are missing (NB! Mozilla Firefox displays the border). To avoid this, add a non-breaking space ( ) to empty data cells, to make the borders visible: <table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td> </td> </tr> </table> TABLE DATA ATTRIBUTES(<td>) ALIGN: horizontal alignment of cell contents VALIGN: vertical alignment of cell contents WIDTH: width of cell HEIGHT: height of cell COLSPAN: number of columns to cover ROWSPAN: number of rows to cover NOWRAP: don't word wrap BGCOLOR: color of the background BORDERCOLOR: color of border around the table BORDERCOLORDARK: color of "dark" part of border around the table BORDERCOLORLIGHT: color of "light" part of border around the table BACKGROUND: picture to use as background ALIGN = LEFT | CENTER | MIDDLE | RIGHT (horizontal alignment) VALIGN: TOP | MIDDLE | CENTER | BOTTOM | BASELINE (vertical alignment) Example. <td align=right valign=top background="http://www.dwdtek.com/DW1Boutique/boutiquebg.jpg"> Try various combinations of attributes until you get the desired results. TABLE ROW ATTRIBUTES(<tr>) ALIGN = LEFT | CENTER | RIGHT ALIGN sets the horizontal alignment of the cells in the row. One of the most common situations where ALIGN is useful is when you have a row of table headers that you want to align left with the text instead of being centered. So, for example, this code sets the first row of cells to align left: ***TABLE EFFECTS*** Create cool borders around your tables or around text included in a table. Change the filter value (ie. "filter:glow) to any of the following available effects: glow, shadow, dropshadow. Define the color of the effect as desired. Strength minimum is 1 and maximum effect is 10. Example. <table style="filter:glow(color=yellow, strength=10)"> <td> <center> <font size=7 color=white> Amy </font> </center> </td> </tr> </table> Nested Tables What are nested tables? To put it simply it's alot like those old Russian nesting dolls. A table within a table looks something like the following: <table border=2 bordercolor=red> <tr> <td> <center> <table bgcolor=lime> <tr> <td> <center> <font color=black size=7> TEST </font> </center> </td> </tr> </table> </td> </tr> </table> The sections in bold are the external table and the italicized section is the central table. You can nest tables within tables as many tables deep as desired so long as all of your closing tags match up. (It's a good idea to add extra spacing between levels of the table in order not to get lost in the codes). IFRAME - Inline Frame Syntax: <IFRAME>...</IFRAME> Attribute Specifications: SRC=URI (URI of frame content) NAME=CDATA (name of frame) LONGDESC=URI (link to long description) WIDTH=Length (frame width) HEIGHT=Length (frame height) ALIGN=[ top | middle | bottom | left | right ] (frame alignment) FRAMEBORDER=[ 1 | 0 ] (frame border) MARGINWIDTH=Pixels (margin width) MARGINHEIGHT=Pixels (margin height) SCROLLING=[ yes | no | auto ] (ability to scroll) core attributes Contents: Inline elements, block-level elements Contained in: Block-level elements, inline elements except BUTTON The IFRAME element defines an inline frame for the inclusion of external objects including other HTML documents. IFRAME provides similar functionality to OBJECT. One advantage of IFRAME is that it can act as a target for other links. However, OBJECT is included in HTML 4 Strict while IFRAME is not. IFRAME's SRC attribute provides the location of the frame content--typically an HTML document. The optional NAME attribute specifies the name of the inline frame, allowing links to target the frame. The content of the IFRAME element is used as an alternative for browsers that are not configured to show or do not support inline frames. The content may consist of inline or block-level elements, though any block-level elements must be allowed inside the containing element of IFRAME. For example, an IFRAME within an H1 cannot contain an H2, but an IFRAME within a DIV can contain any block-level elements. The LONGDESC attribute gives the URI of a long description of the frame's contents. This is particularly useful for full descriptions of embedded objects. Note that LONGDESC describes the frame content while the content of the IFRAME element acts as a replacement when the external resource cannot be inlined. An example follows: <IFRAME SRC="http://htmlhelp.com/reference/html40/special/recipe.html" TITLE="The Famous Recipe"> <!-- Alternate content for non-supporting browsers --> <H2>The Famous Recipe</H2> <H3>Ingredients</H3> ... </IFRAME> The WIDTH and HEIGHT attributes specify the dimensions of the inline frame in pixels or as a percentage of the available space. The FRAMEBORDER attribute specifies whether or not a border should be drawn. The default value of 1 results in a border while a value of 0 suppresses the border. Style sheets allow greater flexibility in suggesting the border presentation. The ALIGN attribute specifies the alignment of the inline frame. The values top, middle, and bottom specify the frame's position with respect to surrounding content on its left and right. ALIGN=middle aligns the vertical center of the frame with the current baseline. To center the frame horizontally on the page, place the frame in a centered block, e.g., <P ALIGN=center><IFRAME SRC="foo.html" WIDTH=300 HEIGHT=100></IFRAME></P> The other ALIGN values, left and right, specify a floating frame; the frame is placed at the left or right margin and content flows around it. To place content below the frame, use <BR CLEAR=left|right|all> as appropriate. The vertical-align and float properties of Cascading Style Sheets provide more flexible methods of aligning inline frames. The MARGINWIDTH and MARGINHEIGHT attributes define the number of pixels to use as the left/right margins and top/bottom margins, respectively, within the inline frame. The value must be a non-negative integer. The SCROLLING attribute specifies whether scrollbars are provided for the inline frame. The default value, auto, generates scrollbars only when necessary. The value yes gives scrollbars at all times, and the value no suppresses scrollbars--even when they are needed to see all the content. Recommended Webdesign Practices; 1) ALWAYS test your page offline before uploading it to the internet! 2) Make sure to check all links and images before going live with your website! Recommended Webhost: http://www.brinkster.com Recommended FTP Program: Core FTP LE (FREE!!!) Additional Resources: HTML Cheat Sheet! The Javascript Source Introduction to CSS Content ©Copyright 2008 Gretchen L. Holcer (IMVU DreamWeaver1)