0% found this document useful (0 votes)
8 views12 pages

HTML Basics Welcome To HTML Basics

This document is a workshop guide on HTML basics, teaching users how to create web pages using Hyper Text Markup Language. It covers essential topics such as basic HTML tags, document structure, attributes, and styling, along with practical exercises for hands-on learning. Prerequisites include a text editor and an internet browser, and the guide emphasizes the importance of using proper syntax and lowercase tags.

Uploaded by

prabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views12 pages

HTML Basics Welcome To HTML Basics

This document is a workshop guide on HTML basics, teaching users how to create web pages using Hyper Text Markup Language. It covers essential topics such as basic HTML tags, document structure, attributes, and styling, along with practical exercises for hands-on learning. Prerequisites include a text editor and an internet browser, and the guide emphasizes the importance of using proper syntax and lowercase tags.

Uploaded by

prabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

HTML Basics Welcome to HTML Basics.

This workshop leads you through the basics of Hyper


Text Markup Language (HTML). HTML is the building block for web pages. You will learn to
use HTML to author an HTML page to display in a web browser. Objectives: By the end of this
workshop, you will be able to: ƒ Use a text editor to author an HTML document. ƒ Be able to use
basic tags to denote paragraphs, emphasis or special type. ƒ Create hyperlinks to other
documents. ƒ Create an email link. ƒ Add images to your document. ƒ Use a table for layout. ƒ
Apply colors to your HTML document. Prerequisites: You will need a text editor, such as
Notepad and an Internet browser, such as Internet Explorer or Netscape. Q: What is Notepad and
where do I get it? A: Notepad is the default Windows text editor. On most Windows systems,
click your Start button and choose Programs then Accessories. It should be a little blue notebook.
Mac Users: SimpleText is the default text editor on the Mac. In OSX use TextEdit and change
the following preferences: Select (in the preferences window) Plain text instead of Rich text and
then select Ignore rich text commands in HTML files. This is very important because if you don't
do this HTML codes probably won't work. One thing you should avoid using is a word processor
(like Microsoft Word) for authoring your HTML documents. What is an html File? HTML is a
format that tells a computer how to display a web page. The documents themselves are plain text
files with special "tags" or codes that a web browser uses to interpret and display information on
your computer screen. ƒ HTML stands for Hyper Text Markup Language ƒ An HTML file is a
text file containing small markup tags ƒ The markup tags tell the Web browser how to display
the page ƒ An HTML file must have an htm or html file extension Try It? Open your text editor
and type the following text:

This is my first homepage. This text is bold

Save the file as mypage.html. Start your Internet browser. Select Open (or Open Page) in the File
menu of your browser. A dialog box will appear. Select Browse (or Choose File) and locate the
html file you just created - mypage.html - select it and click Open. Now you should see an
address in the dialog box, for example C:\MyDocuments\mypage.html. Click OK, and the
browser will display the page. To view how the page should look, visit this web page:
http://profdevtrain.austincc.edu/html/mypage.html Example Explained What you just made is a
skeleton html document. This is the minimum required information for a web document and all
web documents should contain these basic components. The first tag in your html document is .
This tag tells your browser that this is the start of an html document. The last tag in your
document is

. This tag tells your browser that this is the end of the html document. The text between the tag
and the tag is header information. Header information is not displayed in the browser window.
The text between the

This is my first homepage. This text is bold

This is an HTML element: This text is bold The HTML element begins with a start
tag: The content of the HTML element is: This text is bold The HTML element ends
with an end tag: The purpose of the tag is to define an HTML element that should
be displayed as bold. This is also an HTML element:
This is my first homepage. This text is bold

This HTML element starts with the start tag

, and ends with the end tag

. The purpose of the

tag is to define the HTML element that contains the body of the HTML document.
Nested Tags You may have noticed in the example above, the

tag also contains other tags, like the tab. When you enclose an element in with
multiple tags, the last tag opened should be the first tag closed. For example:

This is NOT the proper way to close nested tags.

This is the proper way to close nested tags.

Note: It doesn't matter which tag is first, but they must be closed in the proper
order. Why Use Lowercase Tags? You may notice we've used lowercase tags even
though I said that HTML tags are not case sensitive. means the same as . The
World Wide Web Consortium (W3C), the group responsible for developing web
standards, recommends lowercase tags in their HTML 4 recommendation, and
XHTML (the next generation HTML) requires lowercase tags. Tag Attributes Tags
can have attributes. Attributes can provide additional information about the HTML
elements on your page. The tells the browser to do something, while the attribute
tells the browser how to do it. For instance, if we add the bgcolor attribute, we can
tell the browser that the background color of your page should be blue, like this:

. This tag defines an HTML table:

. With an added border attribute, you can tell the browser that the table should have no borders:

. Attributes always come in name/value pairs like this: name="value". Attributes are always
added to the start tag of an HTML element and the value is surrounded by quotes. Quote Styles,
"red" or 'red'? Attribute values should always be enclosed in quotes. Double style quotes are the
most common, but single style quotes are also allowed. In some rare situations, like when the
attribute value itself contains quotes, it is necessary to use single quotes: name='George
"machine Gun" Kelly' Note: Some tags we will discuss are deprecated, meaning the World Wide
Web Consortium (W3C) the governing body that sets HTML, XML, CSS, and other technical
standards decided those tags and attributes are marked for deletion in future versions of HTML
and XHTML. Browsers should continue to support deprecated tags and attributes, but eventually
these tags are likely to become obsolete and so future support cannot be guaranteed. For a
complete list of tags, visit W3C.org. Basic HTML Tags The most important tags in HTML are
tags that define headings, paragraphs and line breaks. Basic HTML Tags Tag Description
Defines an HTML document

Defines the document's body

to
Defines header 1 to header 6

Defines a paragraph
Inserts a single line break

Defines a horizontal rule be displayed like this.

This HTML comment would be displayed like this. Notice you don't see the text between the tags . If you look at the source code, you would see
the comment. To view the source code for this page, in your browser window, select View and then select Source. Note: You need an exclamation
point after the opening bracket . HTML automatically adds an extra blank line before and after some elements, like before and after a paragraph,
and before and after a heading. If you want to insert blank lines into your document, use the
tag. Try It Out! Open your text editor and type the following text:

My First Webpage
Welcome to my first web page. I am writing this page using a text editor and plain old html.

By learning html, I'll be able to create web pages like a pro....


which I am of course.

Save the page as mypage2.html. Open the file in your Internet browser. To view how the page should look, visit this web page:
http://profdevtrain.austincc.edu/html/mypage2.html Other HTML Tags As mentioned before, there are logical styles that describe what the text
should be and physical styles which actually provide physical formatting. It is recommended to use the logical tags and use style sheets to style the
text in those tags. Logical Tags Physical Tags Tag Description Defines an abbreviation Defines an acronym

Defines an address element Defines a citation Defines computer code text

Defines a long quotation Defines text Defines a definition term Defines


emphasized text Defines inserted text Defines keyboard text

Defines preformatted text

Defines a short quotation

Defines sample computer code

Defines strong text


Defines a variable

Tag Description

Defines bold text

Defines big text

Defines italic text

Defines small text

Defines superscripted text

Defines subscripted text

Defines teletype text

Deprecated. Use styles instead

Character tags like and produce the same physical display as and but are more

uniformly supported across different browsers.

Some Examples:

The following paragraph uses the

tag. In the previous sentence, the blockquote tag is

enclosed in the Sample tag.

We the people of the United States, in order to form a more perfect Union, establish Justice,

insure domestic Tranquility, provide for the common defense, promote the general Welfare, and

secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this

Constitution for the United States of America.

Although most browsers render blockquoted text by indenting it, that's not specifically what it's

designed to do. It's conceivable that some future browser may render blockquoted text in some other

way. However, for the time being, it is perfectly safe to indent blocks of text with the

.
This Code Would Display

WWW WWW

When you hold your mouse pointer over the WWW, text in the title attribute will appear in.

HTML Character Entities

Some characters have a special meaning in HTML, like the less than sign (< less than < <

> greater than > >

& ampersand & &

" quotation mark " "

' apostrophe &apos; (does not work in IE) '

A character entity has three parts: an ampersand (&), an entity name or an entity number, and finally

a semicolon (;). The & means we are beginning a special character, the ; means ending a special

character and the letters in between are sort of an abbreviation for what it's for. To display a less than

sign in an HTML document we must write: < or < The advantage of using a name instead of a

number is that a name is easier to remember. The disadvantage is that not all browsers support the

newest entity names, while the support for entity numbers is very good in almost all browsers.

Note: Entities are case sensitive.

Non-breaking Space

The most common character entity in HTML is the non-breaking space . Normally HTML will

truncate spaces in your text. If you add 10 spaces in your text, HTML will remove 9 of them. To add

spaces to your text, use the character entity.

This Code Would Display

This code would appear

as this.

This code would appear as this.


This Code Would Display

This code would

appear with three extra spaces.

This code would appear with three extra

spaces.

To see a list of character entities, visit this page:

http://profdevtrain.austincc.edu/html/entities.htm

HTML Fonts

The tag in HTML is deprecated. The World Wide Web Consortium (W3C) has removed the

tag from its recommendations. In future versions of HTML, style sheets (CSS) will be used to

define the layout and display properties of HTML elements.

The Tag Should NOT be used.

HTML Backgrounds

Backgrounds

The

tag has two attributes where you can specify backgrounds. The background can be a color

or an image.

Bgcolor

The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute can be

a hexadecimal number, an RGB value, or a color name:

The lines above all set the background-color to black.


Background
The background attribute can also specify a background-image for an HTML page. The value of this
attribute is the URL of the image you want to use. If the image is smaller than the browser window,
the image will repeat itself until it fills the entire browser window.
The URL can be relative (as in the first line above) or absolute (as in the second line above).
If you want to use a background image, you should keep in mind:
ƒ Will the background image increase the loading time too much?
ƒ Will the background image look good with other images on the page?
ƒ Will the background image look good with the text colors on the page?
ƒ Will the background image look good when it is repeated on the page?
ƒ Will the background image take away the focus from the text?
Note: The bgcolor, background, and the text attributes in the
tag are deprecated in
the latest versions of HTML (HTML 4 and XHTML). The World Wide Web Consortium (W3C) has
removed these attributes from its recommendations. Style sheets (CSS) should be used instead
(to define the layout and display properties of HTML elements).
Try It Out!
Open your text editor and type the following text:

My First Webpage

Welcome to my first webpage. I am writing this page using a text

editor and plain old html.

By learning html, I'll be able to create webpages like a beginner

pro....

which I am of course.

Save your page as mypage3.html and view it in your browser. To view how the page should look,
visit this web page: http://profdevtrain.austincc.edu/html/mypage3.html
Notice we gave our page a background color as well as a background image. If for some reason the
web page is unable to find the picture, it will display our background color.
HTML Colors
Color Values
Colors are defined using a hexadecimal notation for the combination of red, green, and blue color
values (RGB). The lowest value that can be given to one light source is 0 (hex #00). The highest value
is 255 (hex #FF). This table shows the result of combining red, green, and blue:
Color Color HEX Color RGB
#000000 rgb(0,0,0)
#FF0000 rgb(255,0,0)
#00FF00 rgb(0,255,0)
#0000FF rgb(0,0,255)
#FFFF00 rgb(255,255,0)
#00FFFF rgb(0,255,255)
#FF00FF rgb(255,0,255)
#C0C0C0 rgb(192,192,192)
#FFFFFF rgb(255,255,255)
Color Names
A collection of color names is supported by most browsers. To view a table of color names that are
supported by most browsers visit this web page:
http://profdevtrain.austincc.edu/html/color_names.htm
Note: Only 16 color names are supported by the W3C HTML 4.0 standard (aqua, black, blue,
fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow). For
all other colors you should use the Color HEX value.
Color Color HEX Color Name
#F0F8FF AliceBlue
#FAEBD7 AntiqueWhite
#7FFFD4 Aquamarine
#000000 Black
#0000FF Blue
#8A2BE2 BlueViolet
#A52A2A Brown
Web Safe Colors
A few years ago, when most computers supported only 256 different colors, a list of 216 Web Safe
Colors was suggested as a Web standard. The reason for this was that the Microsoft and Mac operating
system used 40 different "reserved" fixed system colors (about 20 each). This 216 cross platform web
safe color palette was originally created to ensure that all computers would display all colors correctly
when running a 256 color palette. To view the 216 Cross Platform Colors visit this web page:
http://profdevtrain.austincc.edu/html/216.html
16 Million Different Colors
The combination of Red, Green and Blue values from 0 to 255 gives a total of more than 16 million
different colors to play with (256 x 256 x 256). Most modern monitors are capable of displaying at
least 16,384 different colors. To assist you in using color schemes, check out
http://wellstyled.com/tools/colorscheme2/index-en.html. This site lets you test different color
schemes for page backgrounds, text and links.
HTML Lists
HTML provides a simple way to show unordered lists (bullet lists) or ordered lists (numbered lists).
Unordered Lists
An unordered list is a list of items marked with bullets (typically small black circles). An unordered list
starts with the
tag. Each list item starts with the

 tag.
 This Code Would Display


o Coffee

o Milk


 ƒ Coffee
 ƒ Milk
 Ordered Lists
 An ordered list is also a list of items. The list items are marked with numbers. An ordered list starts
o with the

tag. Each list item starts with the

[2.] tag.
[3.] This Code Would Display
[4.]
[5.]
[1.] Coffee
[6.]
[1.] Milk
[7.]
[8.]
[9.] 1. Coffee
[10.] 2. Milk
[11.] Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
[12.] Definition Lists
[13.] Definition lists consist of two parts: a term and a description. To mark up a definition list, you need
[1.] three HTML elements; a container , a definition term

, and a definition description


.
This Code Would Display

Cascading Style Sheets

Style sheets are used to provide


presentational suggestions for
documents marked up in HTML.

Cascading Style Sheets


Style sheets are used to provide
presentational suggestions for
documents marked up in HTML.
Inside a definition-list definition (the
tag) you can put paragraphs, line breaks, images, links,
other lists, etc
Try It Out
Open your text editor and type the following:

My First Webpage

Welcome to my first webpage. I am writing this page using a text


editor and plain old html.

By learning html, I'll be able to create web pages like a pro....

which I am of course.

Here's what I've learned:

 How to use HTML tags

 How to use HTML colors

 How to create Lists

Save your page as mypage4.html and view it in your browser. To see how your page should look visit
this web page: http://profdevtrain.austincc.edu/html/mypage4.html
HTML Links
HTML uses the anchor tag to create a link to another document or web page.
The Anchor Tag and the Href Attribute
An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a movie, etc.
The syntax of creating an anchor:
Text to be displayed
The tag is used to create an anchor to link from, the href attribute is used to tell the address of
the document or page we are linking to, and the words between the open and close of the anchor tag
will be displayed as a hyperlink.
This Code Would Display
Visit ACC! Visit ACC!
The Target Attribute
With the target attribute, you can define where the linked document will be opened. By default, the
link will open in the current window. The code below will open the document in a new browser window:
Visit ACC!
Email Links
To create an email link, you will use mailto: plus your email address. Here is a link to ACC's Help Desk:
Email Help Desk
To add a subject for the email message, you would add ?subject= after the email address. For
example:
Email Help Desk
The Anchor Tag and the Name Attribute
The name attribute is used to create a named anchor. When using named anchors we can create links
that can jump directly to a specific section on a page, instead of letting the user scroll around to find
what he/she is looking for. Unlike an anchor that uses href, a named anchor doesn't change the
appearance of the text (unless you set styles for that anchor) or indicate in any way that there is
anything special about the text. Below is the syntax of a named anchor:
Text to be displayed
To link directly to the top section, add a # sign and the name of the anchor to the end of a URL, like
this:
This Code Would Display
Back to top of page
A hyperlink to the top of the page from
within the file 10links.html will look like
this:
Back to top of page
Back to top of page

Back to top of page


Note: Always add a trailing slash to subfolder references. If you link like this:
href="http://profdevtrain.austincc.edu/html", you will generate two HTTP requests to the
server, because the server will add a slash to the address and create a new request like this:
href="http://profdevtrain.austincc.edu/html/"
Named anchors are often used to create "table of contents" at the beginning of a large document. Each
chapter within the document is given a named anchor, and links to each of these anchors are put at
the top of the document. If a browser cannot find a named anchor that has been specified, it goes to
the top of the document. No error occurs.
HTML Images
The Image Tag and the Src Attribute
The Error! Filename not specified. 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:
This Code Would Display

Not only does the source attribute specify what image to use, but where the image is located. The
above image, graphics/chef.gif, means that the browser will look for the image name chef.gif in a
graphics folder in the same folder as the html document itself.
src="chef.gif" means that the image is in the
same folder as the html document calling for it.
src="images/chef.gif" means that the image is
one folder down from the html document that
called for it. This can go on down as many layers
as necessary.
src="../chef.gif" means that the image is in
one folder up from the html document that called
for it.
src="../../chef.gif" means that the image is
two folders up from the html document that called
for it.
src="../images/chef.gif" means that the image
is one folder up and then another folder down in
the images directory.
src="../../../other/images/chef.gif" means
this goes multiple layers up.
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
author-defined text:

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 or use screen rea

You might also like