360 likes | 372 Vues
Learn the basics of HTML, including tags, syntax, formatting, and creating web pages with links, images, and lists.
E N D
CSC 110 – Fluency in Information TechnologyChapter 4: HTML: A Hypertext Markup Language Primer Dr. Curry Guinn
Quick Info http://people.uncw.edu/guinnc/courses/Fall08/110/csc110.htm • Choose your book by 09/07: • http://people.uncw.edu/guinnc/courses/fall08/110/books.htm
Today’s Class • Chapter 4: Overview of HTML • Laboratory Activities • Making a Web Page
A Web page and the HTML source that produced it. Notice that an additional image file, alto.jpg, is also required to display the page.
HTML • Hypertext Markup Language • “Hypertext” means that you can click on words, phrases, images and you will be taken to another page. • “Marking up” a page means that you supply tags to indicate to the computer how to format and display the text or pictures.
Tags • Tags have a very specific syntax • Each tag is enclosed in angle brackets <> • Tags often come in pairs <title> CSC 110 </title> • The text that is being formatted is enclosed within the pair • Notice the / used to indicate the end of a tag pair • BTW, tags aren’t case sensitive. <Title> CSC 110 </TITLe>
Tags for Bold and Italic • <b> … </b> makes what is inside the tags bold <b> Hello </b> there • would be displayed Hello there • Similarly <i> … </i> makes things italics. <i> Hello </i> there • would be displayed Hello there
You can nest tags inside one another if appropriate <b> <i> Hello </i> there <b> • Produces Hello there • Be careful to get your tags nested correctly: <b> <i> Hello </b> </i> • May result in an error.
To make a paragraph <p> This is a lot of text. It will become a paragraph. </p>
Not all tags come in pairs • <br> forces a line return in the display. • <hr> displays a horizontal line.
Every HTML file should look like …. <html> <head> Preliminary material like title, keywords, description </head> <body> The main content of the page </body> </html>
Headers <h1> I’m a big header </h1> <h2> I’m not as big </h2> <h3> I have a complex </h3>
White space in your .html source file … • … Is ignored John is my brother • Will appear as John is my brother John is my brother • Will also appear as John is my brother
Aligning text <p align = “center”> Content, content, content. </p> Content, content, content. <p align = “left”> Content, content, content. </p> Content, content, content. <p align = “right”> Content, content, content. </p> Content, content, content.
Making Links • The words that are “hot” are called the anchor text. • When you click on those “hot” words, the browser will be directed to the hyperlink reference. • To specify an anchor <a href=“http://www.google.com”> This will take you to google. </a>
Absolute vs. Relative Pathnames • http://www.google.com is a absolute pathname as it gives the full address. • So is http://people.uncw.edu/guinnc/courses/Fall08/110/csc110.htm • A relative pathname specifies a link that is relative to the current web page notes/day1_intro/IntroTo110.ppt
Images <img src=“filename”> • The two main image formats for Web pics are GIF and JPEG. • GIF is better for cartoons/line drawings. • JPEG is intended for photos. • Bitmaps (.bmp) are older technology. Huge. • You can align and resize images <img src=“pipe.jpg” align=“center” width=“100”>
Color • You can change the color of your text <font color=“red”> Here is my text. </font> Here is my text. • And the color of your background <body bgcolor = “teal”> … </body>
Color cont. • Color can be specified using the 16 color constants (e.g., black, red, blue, lime, etc) • See p. 104 • Or by specifying the Red/Green/Blue combination (RGB) • (255, 0, 0) The most red • (0, 255, 0) The most green • (0, 0, 255) The most blue • In html, you specify these in hexadecimal format • #FF0000 is (255,0,0) • See 104-106
Lists <ul> <li> List item one </li> <li> List item two. </li> </ul> • List item one. • List Item two.
Lists, continued <ol> <li> List item one </li> <li> List item two. </li> </ol> • List item one. • List Item two.
Tables • Let’s save this one for your Out-of-Class Assignment
Did you know you can look at any web page’s HTML file? • In your browser, let’s say Internet Explorer • Select from the View menu • Source
UNCW WebPages • Go to this page to learn how to put your own webpage on the www at UNCW. http://www.uncw.edu/itsd/studentwebsrv.htm
Out-of-class Assignment 1 • Make an .htm page that looks like the following images: • http://people.uncw.edu/guinnc/courses/Fall08/110/ooc1/page1.jpg • http://people.uncw.edu/guinnc/courses/Fall08/110/ooc1/page2.jpg • Things you have to do include: <title>, <img> <h1>, <h2>, <hr>, <ul>, <a href=…, <font color = .., <body bgcolor=“teal”>, <table>, <p align=“center”>, <b>, <i>
And now for the lab … • Open up notepad. • We’ll do all our editing in notepad • Why? • Create a small file: <html> <head> </head> <body> </body> </html>
Activity 1 cont. • Save this to a file called lab.htm • Be careful! Notepad is going to try to save it as a .txt file • Once it has been saved, open it in Internet Explorer.
Activity 2 (Putting in some content) • Add a title. Something like “CSC 110 Lab Page” • Remember to use the <title> … </title> tags. • Where do you put the <title> tags? • You can reload your page in Internet Explorer by selecting Refresh • Icon at top • View – Refresh • F5
Activity 3 • Put a little text in there to be displayed. • Where does the text go in the .htm document? • Reload within the browser and see how it looks. • Put some line breaks in your .htm file and reload. Any difference? • Put a few paragraphs in.
Activity 3, cont. • Try to center a paragraph. • Try to right align a paragraph. • Make some things bold and/or italics. • Put a few headings in. • How much bigger is H1 than H2 than H3. • Is there an H4? • An H5?
Activity 4 (Links) • Make a link in your page that looks something like Click Here for Google. • When you click on it, the browser should go to www.google.com. • Make a link in your page that allows you to go to our course homepage.
Activity 4b (Relative Link) • Open a new .htm file using notepad in the same directory as your current .htm document. Call it subpage.htm. • Make a small valid .htm document with a head and body. Give it a title like “My Subpage” and maybe a few words in the body. • Now, make a hypertext link in your original webpage that points to this subpage.htm file. • Use a relative pathname in your anchor specification.
Activity 5 (Images) • Download this image to the directory where your .htm files reside: • Also available at (http://people.uncw.edu/guinnc/courses/Spring08\110\notes\day6_chap4_html\athletic_logo.gif) • Insert this image in your webpage using <img src=“athletic_logo.gif”> • Can you resize it?
Activity 6 (Lists) Make a list that looks something like My favorite books are: • The Long Goodbye by Raymond Chandler. • Fifth Business by Robertson Davies. • Rescuing Patty Heart by Virginia Holman.
Out-of-class Assignment 1 • Make an .htm page that looks like the following images: • http://people.uncw.edu/guinnc/courses/Spring05/110/ooc1/page1.jpg • http://people.uncw.edu/guinnc/courses/Spring05/110/ooc1/page2.jpg • Things you have to do include: <title>, <img> <h1>, <h2>, <hr>, <ul>, <a href=…, <font color = .., <body bgcolor=“teal”>, <table>, <p align=“center”>, <b>, <i>
Wrap-up • Homework • Read Chapter 4 • Out-of-class assignment 1 due by 11:59pm, 09/07 • 3nd Homework: Ch5 & Ch6 questions, due 11:59pm 09/04 • No class on Monday