Introduction to HTML

36,016 views

Published on

Week 9 Lecture slides and audio for ITB/N Organisational Databases, Semester 1, 2008, QUT, Brisbane, Australia.

Published in: Technology
14 Comments
88 Likes
Statistics
Notes
No Downloads
Views
Total views
36,016
On SlideShare
0
From Embeds
0
Number of Embeds
1,390
Actions
Shares
0
Downloads
0
Comments
14
Likes
88
Embeds 0
No embeds

No notes for slide
  • Introduction to HTML

    1. 1. Introduction to Web Design Part 1: HTML
    2. 2. If You Know Nothing About HTML, This is Where You Begin.
    3. 3. HTML Issues for Organisations <ul><li>Why the need to know HTML code? </li></ul><ul><li>WYSIWG (What You See Is What You Get) editors (like Front Page and Dreamweaver) create program-specific code that is incomprehensible to other programs and may not be displayed correctly on all browsers or all operating systems. </li></ul><ul><li>You cannot edit them if you don’t have the original software, OR know enough about HTML and how it works to be able to make small edits yourself. </li></ul><ul><li>Company Intranets mostly use HTML. </li></ul><ul><li>HTML is now also used in e-mail and in e-mail marketing. </li></ul><ul><li>HTML is increasingly used as the basis of stand-alone applications that use a GUI (Graphical User Interface). Eg., an online Calculator with input fields. </li></ul>
    4. 4. Advantages of knowing HTML Code <ul><li>New technologies start out as code without tools </li></ul><ul><ul><li>HTML (early days), JavaScript, Java, ASP, XML </li></ul></ul><ul><li>Even if you use WYSIWYG eidtors, it helps to know HTML code to insert ASP or JavaScript into a HTML file </li></ul><ul><li>If you can read code, you can copy clever ideas from others (within reason and the law). Imitation is the best form of flattery. </li></ul><ul><li>Go to any web page, click on “View” “Page source” or “Source” and the HTML code used to create that web page can be studied, or just copied (within legal and copyright bounds) </li></ul><ul><li>Web authoring tools don’t give as much control. </li></ul><ul><ul><li>Most web professional web designers use HTML . </li></ul></ul>
    5. 5. What is HTML? <ul><li>H yper T ext M arkup L anguage. </li></ul><ul><ul><li>HTML is a computer language that is used to create documents on the World Wide Web. </li></ul></ul><ul><ul><li>HTML is very simple, and logical. It reads from left to right, top to bottom and uses plain text. </li></ul></ul><ul><ul><li>HTML is NOT a programming language, but a mark-up language that uses <Tags> like this. </li></ul></ul><ul><ul><li>The websites you view on the internet are actually text files that consist of HTML Tags. </li></ul></ul>
    6. 6. What is Hypertext? <ul><li>Documents with links to other documents. </li></ul><ul><li>A non-sequential, non-linear method for reading a document. </li></ul><ul><li>Textual data which is linked within itself or across multiple documents or locations </li></ul><ul><li>A nonlinear system of writing that allows users to access text or a narrative through multiple pathways. </li></ul>T
    7. 7. Hypertext in History <ul><li>The cross-referencing system in the Babylonian Talmud. </li></ul>
    8. 8. Hypertext through History <ul><li>A Dictionary or Encyclopedia </li></ul>A page from Dr. Samuel Johnson’s Dictionary with references to the usage of the words in literature.
    9. 9. Hypertext in Academe <ul><li>Citations and Footnotes </li></ul>
    10. 10. Hypertext in Literature <ul><li>A matrix of stories like the Arabian Nights where the One Thousand and One different stories are all interconnected and form a matrix or web of stories. </li></ul>
    11. 11. Macintosh in the 80s <ul><li>A Hypercard enabled Macintosh to construct a series of on-screen `filing cards' that contained textual and graphical information. Users could navigate these by pressing on-screen buttons, taking themselves on a tour of the information in the process. </li></ul><ul><li>Hypertext jumps could only be made to files on the same computer. More like an on-screen filing system. Jumps made to computers on the other side of the world were still out of the question. </li></ul>
    12. 12. Now, what is a mark-up language? <ul><li>A markup language identifies pieces of a document so that another person (or application) can do something with those pieces. </li></ul>Before HTML After HTML
    13. 13. Do you recognise this? <ul><li>Traditionally, “ markup men ” used to markup manuscripts before they were copied or printed. In modern publishing, they are called proofreaders . </li></ul>
    14. 14. A marked-up page (or proof) <ul><li>“Markup men” and proofreaders only look at how the content is presented--they do not edit the content ; content is editors by copyeditors and manuscript editors. </li></ul>
    15. 15. The library science & archives students should recognise this model of a markup language?
    16. 16. The MIM, library science & archives students should recognise this?
    17. 17. The Encode Archival Description used in Archives’ Finding Aids. <ul><li>The EAD or </li></ul><ul><li>The Encoded Archival Description, </li></ul><ul><li>a mark-up standard for encoding archival finding aids (based more on XML, but more on that later) </li></ul>
    18. 18. Recognise these old text formatters?
    19. 19. What do text-formatters do? <ul><li>All formatters distinguish the text to be printed from the instructions about how to print; these instructions are called markup . In HTML, markup looks like <b> markup <b> </li></ul><ul><li>Procedural markup tells the software what to do (space down, paragraph breaks); generic markup describes the thing to be printed (heading, cross-reference, etc.). </li></ul>
    20. 20. A very brief History of HTML <ul><li>Tim Berners-Lee , a British physicist working at CERN labs in Switzerland at the time (1989) is the inventor of HTML, and is often also credited as the inventor of www. </li></ul><ul><li>HTML is based on SGML (Standard Generalized Markup Langauge), which existed since 1940s, but without the ability to link. </li></ul><ul><li>He proposed it as a way for of enabling researchers from remote sites in the world to organize and pool together information. </li></ul><ul><li>He suggested that you could actually link the text in the files themselves, through an agreed-upon mark-up language. </li></ul>
    21. 21. The W3C: A www Consortium <ul><li>Today, the World Wide Web Consortium (W3C) is an international consortium where member organizations, a full-time staff, and the public work together to develop Web standards. Tim Berners-Lee is the Director of the W3C. </li></ul>
    22. 22. internet vs. www <ul><li>The Internet, basically a network of networks , had existed in various other forms around the world, particularly in the US Military and in Scientific communities since 1940s: ARPANET </li></ul><ul><li>The www is a way of accessing the information over the Internet through a HyperText Transfer Protocol (HTTP). It is an information sharing model that is built on top of the Internet. </li></ul><ul><li>www is just a portion of the Internet. </li></ul><ul><li>Internet, and not the www, is what is mostly used for e-mail. </li></ul>
    23. 23. HTML is no different from any other formatting language. <ul><li>HTML is NOT a computer programming language. </li></ul><ul><li>Neither is SQL or XML, although extensions to these languages can be computer languages. </li></ul><ul><li>Just as SQL is a data query language, HTML is simply a text-formatting language </li></ul>
    24. 24. HTML uses Tags to markup the text <ul><ul><li>Tags are instructions that tell your Web browser what to show on the page </li></ul></ul><ul><ul><li>All tags begin with a less-than sign < and end with a greater-than sign > . So anything inside of < > is a tag. </li></ul></ul><ul><ul><li>Each tag must be accompanied by a closing tag, which is exactly the same as the tag except it includes a slash after the less-than sign: </> </li></ul></ul>
    25. 25. Getting Started <ul><li>What you need: </li></ul><ul><ul><li>A computer. </li></ul></ul><ul><ul><li>A web browser. </li></ul></ul><ul><ul><li>A place to house your page/s on the www </li></ul></ul><ul><ul><li>A program to uplaod the page to the home on the www </li></ul></ul><ul><ul><li>A word processor (preferably Windows Notepad or WordPad or MAC TextEdit or other text editing programs. NOT a text formatting program like Word.) </li></ul></ul><ul><ul><li>And you’re ready to make websites! </li></ul></ul>Everything from here on is provided in the practical exercises webpage at http://itbn362.10gbfreewebhost.com , but I will explain if we have time.
    26. 26. Open Notepad
    27. 27. Basic Document Structure <ul><li><!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;> </li></ul><ul><li><html> </li></ul><ul><li><head> </li></ul><ul><li><title> Your Title </title> </li></ul><ul><li><!- container -you can write comments in here for yourself that the browser will not display > </li></ul><ul><li></head> </li></ul><ul><li><body> </li></ul><ul><li>This is where your content goes. </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>
    28. 28. Elements <ul><li>Elements are made up of two tags; a start </li></ul><ul><li>tag and an end tag. Between these tags is </li></ul><ul><li>the element content. </li></ul><ul><li><title> Will Code in HTML for Food </title> </li></ul>
    29. 29. Start Tags <ul><li>A start tag is a left angle bracket followed by </li></ul><ul><li>the name of the element and then a right </li></ul><ul><li>angle bracket. A tag is also referred to as a ‘wicket’ by some. </li></ul><ul><li><title> </li></ul>
    30. 30. End Tags <ul><li>End tags are a left angle bracket and a slash </li></ul><ul><li>followed by the name of the element and </li></ul><ul><li>then a right angle bracket. The slash allows </li></ul><ul><li>the computer to distinguish the end tag from </li></ul><ul><li>the start tag . Tags are case sensitive in the new XHTML standard but not in HTML. </li></ul><ul><li></title> </li></ul>
    31. 31. Empty Elements <ul><li>Certain elements are empty and are </li></ul><ul><li>designated by a slash before the right angle </li></ul><ul><li>bracket in the start tag. </li></ul><ul><li><br/> </li></ul><ul><li>The <br> element is used to insert a line break into </li></ul><ul><li>the document. This tells the computer to stop the </li></ul><ul><li>text at that point and start a new line. As you may </li></ul><ul><li>have guessed the <br> element does not have any </li></ul><ul><li>content so it does not need an end tag but is written as <br/> instead of </br> </li></ul>
    32. 32. Content <ul><li>Most elements will contain multiple </li></ul><ul><li>elements. This may sound confusing but it </li></ul><ul><li>is really very simple. An element that </li></ul><ul><li>contains another element looks like this: </li></ul><ul><li><head> </li></ul><ul><li><title> The document title </title> </li></ul><ul><li></head> </li></ul>
    33. 33. Nesting <ul><li>Nesting means the way in which elements </li></ul><ul><li>contain elements. When we say that </li></ul><ul><li>elements are properly nested we mean that </li></ul><ul><li>each element is completely contained within </li></ul><ul><li>the elements that contain it, and it </li></ul><ul><li>completely contains the elements it </li></ul><ul><li>contains. </li></ul>
    34. 34. Nesting, continued <ul><li><em> Alladin is a <strong> fantastic </strong> story.< /em> </li></ul><ul><li>^ That is perfect HTML </li></ul><ul><li><em> Alladin is a <strong> fantastic </em> story. </strong> </li></ul><ul><li>^ That is not! Can you spot the error? </li></ul><ul><li>The <em> starts outside the <strong> but finishes inside it. The tags are not properly nested. </li></ul>
    35. 35. Required Elements <ul><li>There are four elements that all HTML </li></ul><ul><li>documents must contain. </li></ul><ul><li>They must have a <head> and they must </li></ul><ul><li>contain a <title> . They also must have </li></ul><ul><li><html> and <body> elements. </li></ul>
    36. 36. <html> <ul><li>The <html> element contains the whole </li></ul><ul><li>document. It starts first and finishes </li></ul><ul><li>last. It tells the computer that this is an </li></ul><ul><li><html> document and must always be </li></ul><ul><li>present. </li></ul>
    37. 37. <head> <ul><li>The <head> contains elements that are </li></ul><ul><li>about the document rather than elements </li></ul><ul><li>that are displayed in the page itself and </li></ul><ul><li>includes things like the document title. </li></ul>
    38. 38. <title> <ul><li>The document you must have a <title> </li></ul><ul><li>which describes what the document is. </li></ul><ul><li>Without a <title> the document is not valid. </li></ul>
    39. 39. <body> <ul><li>A last, but certainly not least, the document </li></ul><ul><li>must have a <body> . The <body> is the </li></ul><ul><li>Webpage itself. It comes after the <head> </li></ul><ul><li>and is the only other element that can go in </li></ul><ul><li>your <html> element. Anything that you want </li></ul><ul><li>to put in your page goes in here. </li></ul>
    40. 40. Put It All Together <ul><li><html> </li></ul><ul><li><head> </li></ul><ul><li><title> </li></ul><ul><li>yadda yadda yadda </li></ul><ul><li></title> </li></ul><ul><li></head> </li></ul><ul><li><body> </li></ul><ul><li>blah blah blah blah </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>
    41. 41. Beginning to Write <ul><li>Basic HTML tags </li></ul>Note: Better not to use underline as it may be confused as a link. Underline <u> Underline </u> U Underline Italic <i> Italic </i> I Italic Bold <b> Bold </b> B Bold What it Does Code Used Code Effect
    42. 42. Tags cont. <ul><li>You can use as many tags at one time as you’d like. </li></ul><ul><ul><li>Example: </li></ul></ul><ul><ul><ul><li><b><i><u> Text Text Text </b></i></u> </li></ul></ul></ul><ul><ul><ul><ul><li>Looks like: </li></ul></ul></ul></ul><ul><ul><ul><li>Text Text Text </li></ul></ul></ul><ul><ul><li>Example: </li></ul></ul><ul><ul><ul><li><b> Text </b><i> Text </i><u> Text </u> </li></ul></ul></ul><ul><ul><ul><ul><li>Looks like: </li></ul></ul></ul></ul><ul><ul><ul><li>Text Text Text </li></ul></ul></ul>
    43. 43. Single Tags <ul><li>These tags do not require that you close them (in HTML only). </li></ul>This stands for P aragraph. It does the exact same thing as the <BR> above except this tag skips a line. BR just jumps to the next line, P skips a line before starting the text again. <p> This BR eaks the text and starts it again on the next line. Remember you saved your document as TEXT so where you hit ENTER to jump to the next line was not saved. In an HTML document, you need to denote where you want every carriage return with a <BR>. <br> This command gives you a line across the page. ( HR stands for Horizontal Reference.) <hr> What It Does Tag
    44. 44. Writing Your First Page Looks like this This… Example:
    45. 45. Manipulating Text <ul><li>Heading Commands </li></ul><ul><ul><li><h1> This is Heading 1 </h1> </li></ul></ul><ul><ul><li><h2> This is Heading 2 </h2> </li></ul></ul><ul><ul><li><h3> This is Heading 3 </h3> </li></ul></ul><ul><ul><li><h4> This is Heading 4 </h4> </li></ul></ul><ul><ul><li><h5> This is Heading 5 </h5> </li></ul></ul><ul><ul><li><h6> This is Heading 6< /h6> </li></ul></ul><ul><li>Heading commands create nice, bold text and are quite easy to use. It's a simple command. </li></ul>
    46. 46. Font Size <ul><li>There are twelve font size commands. </li></ul><ul><ul><li>+6 through +1 and -1 through -6 . </li></ul></ul><ul><li>+6 is the largest (it's huge); - 6 is the smallest. </li></ul><ul><ul><li><font size=&quot;+1&quot;> This is +1 </font> </li></ul></ul><ul><ul><li>[These are deprecated in XHTML in favour of Style Sheets, but that is not within the scope of our class] </li></ul></ul>
    47. 47. Font Color and Face <ul><li>HTML uses Hex Codes for colors. A hex code is a 6 digit code that translates into a specific color. </li></ul><ul><ul><li><font color=“#FFFFFF”> White Text </font> </li></ul></ul><ul><li>To change the Font of your text, use the Face attribute. </li></ul><ul><ul><li><font face=“arial”> Arial Text </font> </li></ul></ul><ul><ul><li>[ NOTE: These are deprecated in XHTML in favour of Style Sheets, but that is not within the scope of our class. Once you’ve learned HTML, you can look up an XHTML reference sheet for the changes ] </li></ul></ul>
    48. 48. Text Alignment <ul><li>To center text, simply place <center> before the text, and </center> at the end of the text you want centered. </li></ul><ul><li>To move text to the left or the right, use the <p> tag. </li></ul><ul><ul><li><p ALIGN=“right”> Text is pushed to the right .</p> </li></ul></ul><ul><ul><li>Note: </li></ul></ul><ul><ul><li>All HTML tags use American spelling: color, center etc. </li></ul></ul>
    49. 49. Remember! <ul><li>Write the page as you would any other text document. </li></ul><ul><li>When you SAVE the document always click ‘Save As…’ and ALWAYS save the file as TEXT DOCUMENT (.txt), but with an extension of .html </li></ul><ul><ul><li>If you don’t save as a Text only document, your computer will save it as it’s default format. </li></ul></ul>
    50. 50. The End <ul><li>This is in fact not really the end, but it is the </li></ul><ul><li>end of the basics . We have seen that there </li></ul><ul><li>are rules to be followed when writing your </li></ul><ul><li>HTML documents, and we've looked at the </li></ul><ul><li>basic building blocks of HTML. As long as </li></ul><ul><li>you follow these rules, you are on your way </li></ul><ul><li>to creating HTML web pages and perhaps even learn XHTML! </li></ul>

    ×