HTMLBasics Usinf HTML Web Authoring
HTMLBasics Usinf HTML Web Authoring
Introduction to HTML
HTML
For this class, you will have to create a web page using HTML
Not all tags need a closing tag, but its always safer to include it
An html document should end with the extension “.html” or “.htm”
As I will demonstrate, an html document can be written using notepad; no special
software is needed
HTML Tags
First tag: <HTML>
First tag in document
Without it, the browser would think it was viewing a text document
For the purposes of this intro, will look at the <TITLE> tag and
<META name=“description” content=”...”> tag that go within the <HEAD> container;
that is, between the <HEAD> and </HEAD> tags
<TITLE> Tag
Belongs inside the <HEAD> container; between <HEAD> and </HEAD>
Defines the title of the page that you see at the top of web browser
Not something you see when viewing a web site, but used by search engines
Example: <META name = "description" content = "This is a web page about my trip to the arctic.">
Head examples
HTML is “open”, possible to see the source code of any web page you visit
In Firefox, can get source code by clicking on “View” menu, then selecting “Page Source”
Show HTML source of a couple web pages that many of you visited yesterday
Ignore all the “other (more “advanced”) stuff' and note that:
they all have an <HTML> tag near the top
followed by a <HEAD> tag
followed soon by a <TITLE> tag
and a <META name=“description” content=”...”> tag
then a </HEAD> tag before the <BODY> tag
and eventually have </BODY> and </HTML> tags
ESPN Example
ESPN Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ESPN: The Worldwide Leader In Sports</title>
<!-- GENDATE: 1192464125566 -->
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<div id="container">
<!-- begin uni login -->
<script type="text/javascript">
var returnURL = document.location.href;
.................................................... (REST OF BODY)
<!--end revenueScience-->
</div></div></body></html>
Facebook Example
Facebook Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" id="facebook">
<head>
<title>Facebook | Welcome to Facebook!</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="noodp" />
<meta name="description" content="Facebook is a social utility that connects people with friends and others who work, study and
live around them. People use Facebook to keep up with friends, upload an unlimited number of photos, share links and videos, and
learn more about the people they meet." />
<script type="text/javascript">var cc=new Image();cc.onload=function(){cc.hit=(typeof(Env)=="undefined");};cc.src="http://static.ak.facebook.com
<link rel="stylesheet" href="http://static.ak.facebook.com/css/apps_menu.css?12:43718" type="text/css"/>
..................................
<div id="book">
<div id="sidebar"><a href="http://www.facebook.com" class="go_home"> </a><div id="sidebar_content"><script type="text/javascript">
function quicklogin() { document.cookie = "test_cookie=1;domain=.facebook.com";}</script>
<div id="squicklogin">
........................
...................................
........................
</body>
</html>
How search Engines use the <META name=“Description” content=”...” tag
“Blurb” about website on Google comes from META tag with name=”description”
How search Engines use the <META name=“Description” content=”...” tag
“Blurb” about website on Google comes from META tag with name=”description”
The <BODY> Tag
The actual “content” of the website lives within the <BODY> tag container, after the </HEAD>
tag and between the <BODY> and </BODY> tags
All the text, images, and links on the webpage belong within the <BODY> tag
container
<HTML>
<HEAD>
<TITLE>Page Title</TITLE>
</HEAD>
<BODY>
Page Body
</BODY>
</HTML>
pageSkeleton.html
“pageSkeleton.html” is a valid html page and has all the necessary tags
Note that the “title” of “pageSkeleton.html” is “Page Title”, and it is displayed at the
top of the browser and at the top of the Tab with the page. This title was defined
between the <TITLE> and </TITLE> tag as discussed earlier
Right now, the only text on the page is “Page Body” since that is the only content between
the <BODY> and </BODY> tags. There are no images or links on the page, and the text
is not formatted in any specific way (so the default formatting is used)
What if the title were not defined?
NOTE: None of these are required, if you do not set them, the default is
TEXT=black, LINK=blue, VLINK=purple, ALINK=red, and
BGCOLOR=white. Also, when you define these, it is not necessary
to use all of them. If you set a background image then you would not
need to define a background color etc...
pageSkeletonRedTextYellowBg.html
<HTML>
<HEAD>
<TITLE>Page Title</TITLE>
</HEAD>
<BODY TEXT="red" LINK="black" VLINK="red" ALINK="purple" BGColor="yellow">
Page Body
</BODY>
</HTML>
pageSkeleton.html vs. pageSkeletonRedTextYellowBg.html
pageSkeleton.html in browser
pageSkeletonRedTextYellowBg.html in browser
Easy to experiment with different text colors, backgrounds, link colors, etc by
adjusting the parameters within the BODY tag
Adding Content to the Web Page
Need a topic for a web page (unless you want to go the “Seinfeld route” and make it
a web page about nothing)
Possible topics:
My topic:
Decide to call the page “arctic.html” and with a title “My Trip To The Arctic”
Written using Notepad, which on every computer with some version of Windows
<HTML>
<HEAD>
<META name = "description" content = "This is a web page about my trip to the arctic.">
<TITLE>My Trip To The Arctic</TITLE>
</HEAD>
<BODY TEXT="blue" LINK="black" VLINK="red" ALINK="purple" BGColor="yellow">
</BODY>
</HTML>
Page “heading” that says “My Trip To The Arctic” where the text is larger than the
text in the rest of the page
Bulleted list of information about me with a bold and underlined heading
Bulleted list of information about my research relating to the trip with a bold heading
Bulleted list of information about the ice camp
Pictures from the Arctic that are currently on my local computer
An image from the web that consists of a map of the arctic
Four paragraph write-up about my experience, where each paragraph is nicely
formatted
Right now, you don't know how to do any of this! (unless you already
have some experience with HTML)
I'll demonstrate adding some of these things in the coming slides, and by the
end of the semester, you should know how to add all these components to a website
Adding the page heading
Want the page heading to say “My Trip to the Arctic”
First I simply add the text “My Trip To the Arctic”, to the .html document after
the <BODY> tag
<HTML>
<HEAD>
<META name = "description" content = "This is a web page about my trip to the arctic.">
<TITLE>My Trip To The Arctic</TITLE>
</HEAD>
<BODY TEXT="blue" LINK="black" VLINK="red" ALINK="purple" BGColor="yellow">
My Trip to the Arctic
</BODY>
</HTML>
arctic.html in browser:
Solution: Use the formatting tag <H1> before the text, which causes the text to be larger
Instead of simply adding “My Trip to the Arctic” to the .html document after the
<BODY> tag, I add“<H1>My Trip to the Arctic”</H1> to the .html document after
the <BODY> tag
Formatting tags:
Used to format the text for display in the browser,
With formatting tags, you can make the text bold, underlined, italicized, and
add line breaks and new paragraphs (among other things)
Just like many other HTML tags, many (but not all) formatting tags have an open tag
(example: <H1>) and a closing tag (example: </H1>). All the text between the <H1>
and </H1> will be formatted according to the “rules” of the <H1> tag
The rule of the <H1> tag is to make the text a certain (and relatively large) size, so
all text between the <H1> and </H1> tags will be relatively large
Tags <H1>, <H2>, <H3>, <H4>, <H5>, and <H6> all used for text size choice:
HTML document
<HTML>
<HEAD>
<META NAME="Description" Content="Demonstration of heading tags">
<TITLE>Demonstration of <H1> to <H6> heading tags</TITLE>
</HEAD>
</HTML>
Demonstration of header tags (and <BODY> tag attributes)
Want to add “About Me” heading, formatted so that it is bold and underlined:
Use the <B> tag to make the text bold
Use the <U> tag to make the text underlined
Add to “arctic.html” (right after <H1>My Trip to the Arctic</H1> and before </BODY>):
<B><U>About Me</U></B>
arctic.html in browser:
Adding the bulleted list
Use the <UL> tag to begin a bulleted list – UL stands for unordered list
Use the <LI> tag to begin a new “bulleted item” in the list; LI stands for List Item
No “closing” </LI> tag is needed for each item, but you do need a
closing </UL> tag to “end” the bulleted list
Want to start with <UL> to begin the unordered list, then add the 4 bulleted “list items”,
putting a <LI> tag in front of each one, finally I use a </UL> tag to end the list
Adding the bulleted list
Added to arctic.html after the <B><U>About Me</U></B> and before </BODY> tag
<UL>
<LI>Name is Scott Grauer-Gray
<LI>Originally from Massachusetts (Go Sox!)
<LI>Graduated from UMASS in 2006
<LI>Currently a grad student at the University of Delaware
</UL>
Arctic-related research
Now add a third bulleted list with the following heading and information:
Third bulleted list shows that it's possible to have a bulleted list within a bulleted list
Current State of web page
What's Missing?
Page has some content, but something is clearly missing in a page about a trip to
a remote location?
Might the person that went to the location want to show “proof” that
they've actually been there, proof that goes beyond words?
To add an image, use the tag <IMG> with the following parameters/attributes
SRC - This is the SouRCe of the image. This would be the image name or location if not in the same
directory as the HTML page that is calling it.
WIDTH - Use this command to define the width of the image in pixels.
HEIGHT - Use this command to define the height of the image in pixels.
BORDER - Use this command to set a visible border around your image (set it to zero when linking
images if you don't want a visible border).
ALT - The ALT command stands for ALTernate text. Use this command to place a short description on
the image (used for non graphical browsers and backup in case your image does not load).
ALIGN - By adding this tag you will make the text wrap around the image. There are three options (left,
right, and center).
Adding images to a page
Parameters/attributes for the image I want to add
WIDTH = “500”
HEIGHT = “400”
BORDER =”0”
Decide to place the image right below the “My Trip to the Arctic” heading of the page
<HTML>
<HEAD>
<META name = "description" content = "This is a web page about my trip to the arctic.">
<TITLE>My Trip To The Arctic</TITLE>
</HEAD>
<BODY TEXT="blue" LINK="black" VLINK="red" ALINK="purple" BGColor="yellow">
<H1>My Trip to the Arctic</H1>
<B><U>About Me</U></B>
...........................
.............................
</BODY></HTML>
arctic.html as viewed in the web browser
Text will “wrap” by default to fit the computer screen, so no need to worry about
text falling off the screen
For a line break in the text (equivalent to “Enter” or “Return” in a word processor such
as Microsoft Word), simply add the <BR> tag
<BR> tag does not have a closing tag
Add <BR> tag(s) to arctic.html to add the desired line break(s) after the image
...................
<BODY TEXT="blue" LINK="black" VLINK="red" ALINK="purple" BGColor="yellow">
<H1>My Trip to the Arctic</H1>
<IMG SRC="ridge.jpg" WIDTH="500" HEIGHT="400" BORDER="0" ALT="Picture of a natural sea ice ridge">
Adding a couple more images
Image to add: seaIce.jpg
...Maybe my site left the user “wanting more” and wanting to see related sites
...Maybe there's a site I like that I want to share with the world
Whatever the reason, I want to add links from my site to other websites (or to
other pages within my website)
Adding links to a website
First, I add a bold links heading: <B>Links</B>
To add a link, use the <A> tag – A in tag stands for anchor
Tag is used for more than “just” making links
However, making links with <A> tag is all we're really going to look at for right now
To create a link, use the <A> tag with the HREF command
Full tag for link is <A HREF=”target”>, where target can be an .html page, an
email address, a link to download a file, or a NAME defined within
the webpage (also using the <A> tag)
All text following the <A HREF=”target”> command will be linked to the
target until the closing </A> tag is used
Adding links to a website
Add a link to the international polar year website
Want linked text to say “International Polar Year website”, and I don't want the text
after that to be linked to the site
Closing </A> tag is very important since it was what “ends” the link; otherwise
the rest of the text on the web page will be linked to the site, which you probably
don't want (and you may very well have seen links that seem “too long”)
Adding links to a website
arctic.html with link to International Polar Year website
Page is a site I've visited before, so the “VLINK” color is used, which is set to be red
Code added below link to International Polar Year link (and before the </BODY> tag)
<BR>
<A HREF="http://aplis07.iarc.uaf.edu/index.php/Main_Page">APLIS 2007 Beaufort Sea Ice Camp Website</A>
<BR>
<A HREF="http://televisionwithoutpity.com">Addicting site about TV shows</A>
<BR>
<A HREF="http://www.yourhtmlsource.com/">HTMLSource - Has more info about HTML</A>
<BR>
<A HREF="http://en.wikipedia.org/wiki/HTML">Wikipedia page on HTML</A>
Did a 4-paragraph write-up about the experience that would fit in well with the page
Worth noting that most commercial websites (ESPN, Facebook, etc.) are
not hand-coded using Notepad like you'll do for this class
However, before using these tools, it's important that you understand
the basics of HTML, like learning how to add before using a calculator,
and learning to crawl before you learn how to walk
More Formatting Tags!
Another important tag involving line breaks is the <P> tag, which does have an
accompanying closing </P> tag
The <P> paragraph tag puts a blank space above and below the text enclosed
in its tags
ParagraphDemo.html
<BODY TEXT=”white”
BGCOLOR=”purple”>
<P>This is paragraph 1</P>
<P>This is paragraph 2</P>
<P>This is paragraph 3</P>
</BODY>