Professional Documents
Culture Documents
HTML Step By Step January 1 2011 The step by step course of HTML is an introduction for the beginners of webpage designers and students. Advance HTML (HTML-5), CSS and JavaScript are available for advance web programming. More on www.eatvc.org/tutorials or on http://forum.eatvc.org Hypertext Mark-up Language
www.eatvc.org www.youthleague.org.pk
What is ?
HTML stands for HyperText Markup Language. Developed by scientist Tim Berners-Lee in 1990, HTML is the "hidden" code that helps us communicate with others on the World Wide Web (WWW). When writing HTML, you add "tags" to the text in order to create the structure. These tags tell the browser how to display the text or graphics in the document. For example, the following document has a simple layout (structure). Notice there are three major parts: a heading, two paragraphs and a bulleted list. To achieve a similar layout in a WWW browser, you need to add tags. Here is the same document with HTML tags (red) added: <html> <head> <title>Why I like to go swimming</title> </head> <body>
<p> Swimming is my most favorite activity in the summer. When the sun is shining and the air is warm, you will find me dipping into my backyard pool. Its not an impressive pool, only three feet deep, but its mine.</p>
<ul> <li>I get lots of exercise</li> <li>I enjoy the freedom</li> <li>I have an opportunity to be in the sun.</li> </ul> </body> </html> And here is the resulting page in your browser. Notice the tags are gone? Thats because the tags tell the browser how to display files but do not show themselves. Viewing the hidden code!
You must have the <html>, <head> and <body> container tags in every HTML file. The <html> tag tells the browser that this is an HTML document. You must begin and end your files with this tag. The <head> tag contains general information like the title of your document. The <body> tag holds all your content: words, pictures, artwork and other stuff. Nesting Part of the web page structure is called nesting. Notice how the tag <title> is nested inside the <head> tag, while <head> and <body> are nested inside <html>. 3. Primary Tags To build any web page you will need four primary tags: <html>, <head>, <title> and <body>. These are all container tags and must appear as pairs with a beginning and an ending. <html></html> Every HTML document begins and ends with the <html> tag. This tells the browser that the following document is an html file. Remember, tags tell the browsers how to display information. <head></head> The <head> tag contains the title of the document along with general information about the file, like the author, copyright, keywords and/or a description of what appears on the page. <title></title> Appears within the <head> tag and gives the title of the page. Try to make your titles descriptive, but not more than 20 words in length. The title appears at the very top of the browser page on the title bar. <body></body> The main content of your page is placed within the body tags: your text, images, links, tables and so on. 4. Creating your first web page Using the primary HTML tags, mentioned in Chapter 3, you are now ready to create your first Web page. Step 1 Open up a text editor (SimpleText for Mac or Notepad for Windows) Step 2 Enter the following: <html> <head> <title> This is my first web page</title> </head> <body> Hello world. This is my first web page. There's more to come.
6. Lists Lists come in a variety of forms with most either numbered or bulleted. The numbered lists are called ordered lists and the bulleted lists are unordered lists. Lists are nested. There is a tag that identifies the type of list, like numbered or bulleted. Then within that tag there is another tag that itemizes the list. Maybe some definitions would help. <ol></ol> The ordered list is a container tag and is used for numbered lists. <ul></ul> The unordered list is a container tag and is used for bulleted lists. <li></li> The listed item tag is a container tag and is nested within the ordered or unordered tags. Here is an example of the differences between ordered and unordered lists. An ordered (numbered) list goes like this: <ol> <li>My first item on the list.</li> <li>My second item on the list.</li> <li>My third item on the list.</li> <li>My fourth item on the list.</li> </ol> In the browser it will appear like this: 1. 2. 3. 4. My first item on the list. My second item on the list. My third item on the list. My fourth item on the list.
An unordered (bulleted) list goes like this: <ul> <li>My first item on the list.</li> <li>My second item on the list.</li> <li>My third item on the list.</li> <li>My fourth item on the list.</li> </ul> In the browser it will appear like this: My first item on the list. My second item on the list. My third item on the list. My fourth item on the list.
Let's apply what we've learned Step 1 Load your text editor once more and open our current HTML document:firstpage.html. Step 2 Your file should appear as below: <html> <head> <title>This is my first web page.</title> </head> <body> <h1>Hello world.</h1> This is my first web page. There's more to come. <hr> <p> I am learning how to use the horizontal rule, headline, paragraph and line break tags. Writing HTML isn't as hard as it appears. </p> <p>Here's a list of items I like about school:<br> Science<br> Reading<br> But most of all--recess!<br> </p> </body> </html> Step 3. Let's add one of the lists noted above. Enter the tags and text that appear in red. <html> <head>
Font tag* Not long ago, Times Roman was the only font you could use with HTML. It is still the font of choice (the default) for the leading browsers. Today, we can choose different font styles as well as several other font options by using the tag: <font></font> The font tag gives you some control over how your page will look. But unlike other tags discussed so far, the font tag does nothing without an attribute (remember an attribute describes what the tag should do). We will cover three attributes used with the font tag: <font size= "#"></font> <font face= "type style name"></font> <font color= "hex code"></font> *A Note to Remember: In the new HTML (version 4.0), the font tag has been deprecated--a big word that means the tag will be dropped in favor of Cascade Style Sheets (CSS). If you would like more information on CSS, please check out the Web site:Style Master to learn more. This changeover--from the font tag to CSS--will happen sometime in the future, but right now many Web sites are still using the font tag. We are in what is called the "transitional period," meaning things are still changing. Font Size So far, we have learned that the only way to change the size of our text is through the headline tag. But that causes a problem. One, if you use this tag, all the text changes and secondly, youll have paragraph breaks before and after the text. So what can you do if you want to change the size of some text within a sentence? Simple, add the attributesize to the font tag. Heres a coded example: Learning HTML code <font size=5> does have its advantages, </font> especially considering how important the WWW has become. The resulting line in a browser: Learning HTML code does have its advantages, especially considering how important the WWW has become. Notice how the type increased? You can also decrease your text. Lets take the same sentence but use size=1.
Let's apply what we've learned Step 1 Load your text editor and open the HTML document we have been working on:firstpage.html Step 2 Here's how to add some attribute codes to your original HTML file. Enter the code listed below in red. <html> <head> <title>This is my first web page.</title> </head> <body bgcolor="#ffff00" text="#000000"> <h1 align="center">Hello world.</h1> <p align="right"><b>This is my first web page. There's more to come.</b>
Other text formatting tags The other text formatting tags are fairly simple to use and understand. Bold and Italic tags To create bold text use: <b></b> To create italicized text use: <i></i> Blockquote Sometimes you may want to indent a sentence or an entire paragraph. Thats when youll want to you the blockquote tag: <blockquote></blockquote> Small and big tags To create copy that is slightly smaller than normal: <small></small> To create copy that is slightly larger than normal:
http:// (hypertext transfer protocol) is a code or what is technically called a protocol that helps one computer talk to another computer. The Internet also has another protocol called FTP (file transfer protocol). www or world wide web lets the server (the computer) know the file is located on the World Wide Web. myschool.com is a domain name or where the Web site is hosted. homework.html is the file or Web page you are seeking. To create a link in HTML, you need the anchor tag: <a></a> Inside the tag, you need the attribute: HREF (hypertext reference). An example of a link looks like this: Harry uses the browser called Netscape. The code looks like this: Harry uses the browser called <a href="http//:www.netscape.com">Netscape</a>. Let's take a closer look at the code:
10. Graphics SRC attribute To help the browser identify and find an image, you use the following command: <img src="filename.gif"> <img src="mystery.jpg" alt="When things go wrong with your code, you need to do some detective work!"> <a href-"graphicsc10.html"><img src=atom.jpg width="119" height="120" alt="Take this link to the Blast-Off page" border="0"></a>
11. Building Web pages with tables. Step 1 Open up a text editor (remember, Simple Text for Mac and Notepad for Windows. Step 2 Enter the following code: <html> <head> <title> This is a page using tables </title> </head> <body bgcolor="ffffff" text="000000"> <h1>A Web Page Using Tables</h1> <table border="1"> <tr> <td>This is column one</td> <td>This is column two</td> <td>This is column three</td> </tr> </table> </body> </html> <html> <head> <title> This is a page using tables </title> </head> <body bgcolor="#ffffff" text="#000000">
Even though some of these Web sites are using some advanced things like frames and java script (coming soon!), each one uses tables as their basic structure. Learning to span rows and columns can help you add variety to your tables too! To begin, let's look at our previous illustration, but this time with some rows and columns expanded.
When creating a table and you want to expand a column or a row you use the following attributes: colspan: expands across a number of columns rowspan: expands across a number of rows
Inside the Frame Building Page The page will be enclosed in HTML and HEAD tags: <HTML><HEAD> ... </HEAD></HTML> The instructions for your frames will be enclosed in the following HTML tags: <FRAMESET> ... </FRAMESET>
<HTML> <HEAD> <FRAMESET COLS="100%" ROWS="80,*"> <FRAME NAME="top" SRC="top.html"> <FRAMESET COLS="120,*">
11. 2) The Radio Button 12. Radio Buttons allow for multiple choices yet the user can only select one. Multiple selections are not allowed with radio buttons. Notice that the NAME is the same for all buttons in a set, but the VALUE is different. Also notice that in the first one, the word "checked" is in the code which defaults "Yes" as being chosen when the page loads. 14. <INPUT type=radio name="happy" checked value="yes"> Yes <INPUT type=radio name="happy" value="no">No <INPUT type=radio name="happy" value="maybe">Maybe Yes 16. 3) The Check Box 17. Check Boxes allow for multiple choices AND multiple selections. The user can select one or more. Notice that the NAME is now different for all checkboxes, but the VALUE is the same. Also notice that in the second two, the word "checked" is in the code which puts a check in the box for "Two" and "Three" when the page loads. 19. <INPUT type=checkbox name="One" value="yes">One <INPUT type=checkbox checked name="Two" value="yes">Two <INPUT type=checkbox checked name="Three" value="yes">Three One 21. 4) The Selector Bar 22. Selector Bars are perfect for questions that have many responses and you don't want to take up a lot of room on a page. They can be set for single or multiple selections Two Three No Maybe
26. 5) The Text Area 27. Text fields are multiple lines of input. Normally this is where people respond with a lengthy answer of a paragraph or more. Be sure to put in the wrap=virtual so that when the typing hits the end of the line it auto wraps to the next line. You can set the columns and rows to whatever you like. And you can put in a default response that is preloaded in the box when the page loads. 29. <TEXTAREA WRAP=VIRTUAL NAME="comments" COLS=20 ROWS=5> Nice Site! </TEXTAREA>
31. 6) The Submit and Reset Button 32. The Submit Button is what sends in the form once the user finishes filling it out. The Reset button erases andthing the user has typed so he can start again. To alter the text that appears on the buttons, change the value atribute to the text you wish to have displayed. 34. <INPUT type=submit name=submit value="Click Here to Continue"> <INPUT type=reset name=reset value="Start Again">
Click Here to Continue Start Again
36. 7) Hidden Values 37. If you had several forms on different pages and you wanted to have a field in the email you received that told you which page it came from, you can put in a hidden field. Only you will ever see this, the user will not. 38. <INPUT type=hidden name=webpage value=from_index_page> EMBED: Inserting video audio.
Hyperlinking: linking from one page to another Hyperlinking, or Linking, is the ability to click on a bit of text or an image and have it jump you to another page, or area of a page. This requires both the Opening <A> and the Closing </A> Anchor Tag. Anchors also must have the HREF= (Hypertext Reference) attribute to work properly: <A HREF=> </A> But this tag is still incomplete and will do nothing until you give it a place to link to: <A HREF="http://www.HTMLclinic.com/example.html"> </A> Now to give your visitor something to click on, put some text between the opening and closing tag, like this: <A HREF="http://www.HTMLclinic.com/example.html">HTML Help For All</A> Now the tag is complete. Try it here: HTML Help For All Page Linking Tips If a page is not on your site put in the web address for the page, like this: <A HREF="http://www.examplesite.com/index.html">Example Site</A> If the page is in the same folder use just the filename, like this: <A HREF="examplepage.html"> Click here </A> If the page is in a different directory or folder reference that right before the page: <A HREF="otherfoldernamehere/page2.html">Page Two</A> Linking to Downloadable Files If you want to make a file available for your visitors to download, use the anchor tag with the filename of the file you wish your visitors to grab: <A HREF="filename.here"> Click here to download the file </A>
http://www.quackit.com/myspace/myspace_code_generators/myspace_falling_text_generator.cfm http://www.w3schools.com/html/default.asp
Here is the copy/paste code for validating your email form. You'll need to edit your existing form to make it work. This code goes between the <HEAD> and the </HEAD> tags in your page:
<script> <!-// E-mail Form - Validator // Bravenet Web Services - www.bravenet.com function checkData() { var correct = true if (document.Bravenet.name.value == "") {correct = false; alert("Please enter your name!")} if (document.Bravenet.replyemail.value == "") {correct = false; alert("Please enter your e-mail address.")} /* You can add more variables above. The name after the word Bravenet has to match the name in the form below. */ if (correct){alert("Thank you for taking your time to fill out this form.")} return correct } //--> </script>
And this RED code must go in your existing form tag. More about HTML:
http://www.w3schools.com/html/default.asp
End.