HTML-and-CSS MODULE Revised Long
HTML-and-CSS MODULE Revised Long
Web Development
It seems like everyone's talking about the Internet these days. But what is it
really? How does it work? How do you access it? And most important, what can it do
for you at work or at home?
With the introduction of the Internet and the World Wide Web, students are able to
access information faster and more efficiently using modern Computer Systems. In
the past, one had to visit national and school libraries and spend large amounts of time
accessing information. Presently any individual can quickly access, save and print
information from any location. One can access the internet from Cyber Cafes, schools,
mobile phones, at home and even at modern libraries through internet service
providers and telecommunication links. Apart from the internet, information e.g.
encyclopaedias, tutorials and documentaries can be accessed from Compact Discs
which are read from computer systems.
What is the Difference between the Internet and World Wide Web?
Many people use the terms Internet and World Wide Web (aka. the Web)
interchangeably, but in fact the two terms are not synonymous. The Internet and the
Web are two separate but related things.
The World Wide Web, or simply Web, is a way of accessing information over the
medium of the Internet. It is an information-sharing model that is built on top of the
Internet. The Web uses the HTTP protocol, only one of the languages spoken over
3
the Internet, to transmit data. Web services, which use HTTP to allow applications to
communicate in order to exchange business logic, use the Web to share information.
The Web also utilizes browsers, such as Internet Explorer or Firefox, to access Web
documents called Web pages that are linked to each other via hyperlinks. Web
documents also contain graphics, sounds, text and video.
The Web is just one of the ways that information can be disseminated over the Internet.
The Internet, not the Web, is also used for e-mail, which relies on SMTP, Usenet news
groups, instant messaging and FTP. So the Web is just a portion of the Internet, albeit
a large portion, but the two terms are not synonymous and should not be confused.
The Internet and the World Wide Web have a whole-to-part relationship. The
Internet is the large container, and the Web is a part within the container. It is
common in daily conversation to abbreviate them as the "Net" and the "Web", and
then swap the words interchangeably.
No single person owns the Internet. No single government has authority over its
operations. Some technical rules and hardware/software standards enforce how
people plug into the Internet, but for the most part, the Internet is a free and open
broadcast medium of hardware networking.
The World Wide Web, or "Web" for short, is a massive collection of digital pages: that
large software subset of the Internet dedicated to broadcasting content in the form of
HTML pages. The Web is viewed by using free software called web browsers. Born in
1989, the Web is based on hypertext transfer protocol, the language which allows you
and me to "jump" (hyperlink) to any other public web page. There are over 65 billion
public web pages on the Web today.
What Kinds of Information are Available?
4
• Text documents
• Graphics files (digitized photographs and artwork),
• Files that contain digitized sound and video
• Software
• Interactive forums
• "Chats," - in which you and other users type (and, in some cases, speak)
messages that are received by the chat participants instantly.
How Do People Use the Internet?
Obviously, the Internet can bring you a whole host of capabilities. But how can
they be put to practical use?
Among the ways that users like you are taking advantage of the Internet are:
• Sharing research and business data among colleagues and like-minded
individuals.
• Communicating with others and transmitting files via E-mail.
• Requesting and providing assistance with problems and questions.
• Marketing and publicizing products and services.
• Gathering valuable feedback and suggestions from customers and business
partners.
The Internet's potential is limited only by users' vision and creativity. And as the
Internet grows, new and innovative uses will surely follow.
HTML and other programming embedded within HTML that makes possible Hypertext.
Hypertext is the ability to have web pages containing links, which are areas in a page
or buttons or graphics on which you can click your mouse button to retrieve another
document into your computer.
• Blogs
Blogs (shortened from web log) came to the mainstream forefront in the early
to mid-2000s. This kind of website operates in reverse-chronological order and
can either support a second website or stand alone in its own right. Blogging is
very popular as it allows a direct and personal interaction with your readers who
can provide comments directly on the website.
• Personal Websites
Personal websites are generated by individuals for friends and family to share
information and pictures with each other. Tehis kind of site has limited use for
businesses (even micro businesses) as they are generally not search engine
friendly in their setup.
• Photo Sharing Websites
These websites have one sole purpose - which is to allow for the uploading and
sharing of photographs online. Generally free to use, they have many practical
uses particularly for those in the artistic and photographic industry.
6
• Informational Websites
These are identified as sites which strive to provide information on a particular
subject or subjects to the reader. Online dictionaries, local councils and real
estate companies are examples of informational websites. They provide you
with information that you may be seeking as well as further details on how you
can contact the company in question if applicable.
Hypert Image
ext
Textfiel
d
Radio
Buttons
Center
Alignm
ent
8
▪ Hyperlink
- is a graphical or a piece of text in an Internet document that can connect
readers to another webpage, or another portion of a document
▪ Image
- is a visual representation (of an object or scene or person or abstraction)
produced on a surface;
▪ Textfield
- is a form element that is used to display a single line text. This object is
used to display the results of a scripts calculation, string manipulation,
etc.
Important Terms.
• Client
- it is a software program of computer that request information from
another software program on another computer
• Server
- it is a software program that interacts with client software in a
client/server environment
- it is also referred to as a computer running the server software and
responds to request for information from client computer.
• Web Browser
- it is an application that allows client to view documents on the Web with
a hypertext content.
- it is also used to view the web pages, text, graphics and videos and hear
sounds on the web.
9
• Download
- It is a process of getting the information from the host computer down to
the local computer
• Upload
- It is the opposite of the download process; it is sending of information
from the local computer to the host computer.
• Hypertext
- it is a clickable underlined text that will automatically bring the user to the
desired Web pages once click.
• Search Engine
- is the toll use when you want to visit a website without knowing its URL.
Questions:
Assignment:
Who is Tim Burners Lee and what are his contribution in the development
of the Web?
10
Learning Outcomes:
Creating an HTML document is easy. To begin coding HTML you need only two things:
First is a simple text editor. Notepad is the most basic of simple-text editors and you
will probably code a fair amount of HTML with it. Second is a web browser, program
that allows you to view web pages such as Internet Explorer, Mozilla Firefox, Google
Chrome etc.
<html>
<head>
<title>This is document title</title>
</head>
<body>
<p>Document description goes here</p>
</body>
</html>
Now you have created one HTML page and you can use a Web Browser to open this
HTML file to see the result. Web Pages are nothing but they are simple HTML files
with some content which can be rendered using Web Browsers.
Every tag consists of a tag name, sometimes followed by an optional list of tag’s
attributes, all placed between opening and closing brackets (< and >).
• Empty Tags – are tags that do not require closing tags. Ex: <Br> tags
• Container Tags – require an opening tag to designate the start of the tag and
a closing tag to denote the end of that tag. </Body >
The <html>Tag
The <html> tag is the containing tag for the whole HTML document. Each
HTML document should have one <html> and each document should end with
a closing </html> tag.
As such, start and end HTML tags enclose all the other HTML tags you use to
web page describe the
• <head>
• <body>
Example:
Following is the example of head tag.
<head>
<title>HTML Basic tags</title>
</head>
Therefore it is important to use a title that really describes the content of your
site. The <title> element should contain only the text for the title and it may not
contain any other elements.
13
Example:
Here is the example of using title tag.
<head>
<title>HTML Basic tags</title>
</head>
Example:
Here is the example of using body tag.
<body>
<p>This is a paragraph tag.</p>
</body>
Note that, even though the default BG is white, you should still code in #FFFFFF,
because older browser's default BG is a nasty grey.
• Text
This will change the colour of all the text on your whole page, unless you have
changed the colour manually (find out how in the text section). Your best bet here
is to leave it black, because that's the easiest to read. Code!
text="#000000"
• background
If you want to put an image as your background, use this attribute, and set the value
to the same as you would for an image src (don't know how? Read the
preceding lesson on images). You can also link to an image from another site, by
giving the entire URL.
background="http://www.yoursite.com/media/BACKGROUND.gif"
Whatever image you choose to use, it will be tiled across your page, filling it up.
That means it will repeat itself across your page, so choose one that doesn't
look too obvious.
If you want your background to be set in place and not scroll, add the
attributebgproperties="fixed" into the body. This will leave the image as
a watermark.
• margins
There are two sets of margins on a page, the ones at the sides and the ones at the
top and bottom. The two main browsers use different attributes to put in these
margins, so when you change one, change the other as well.
For Internet Explorer: topmargin="0" and leftmargin="0"
For Netscape: marginheight="0" and marginwidth="0"
Despite this, the units of measurement are the same — pixels, so to make your
margins the same in both browsers just set them both to the same value.
Now if we will put all these tags together, it will constitute a complete HTML document
as follows
<html>
<head>
<title>HTML Basic tags</title>
</head>
<body bgcolor =”blue” text=”white”>
<p>This is a paragraph tag.</p>
</body>
</html>
HTML ATTRIBUTES
• The value is what you want the value of the property to be. The first example
was supposed to use the Arial typeface, so the value of the face attribute is
Arial.
The value of the attribute should be put in double quotation marks, and is separated
from the name by the equals sign. You can see that a color for the text has been
specified as well as the typeface in this <font> element:
Value
Name
Core Attributes:
16
The four core attributes that can be used on the majority of HTML elements (although
not all) are:
• id
• title
• class
• style
The id Attribute
The id attribute can be used to uniquely identify any element within a page (or
style sheet). There are two primary reasons that you might want to use an id
attribute on an element:
• If an element carries an id attribute as a unique identifier it is possible to
identify just that element and its content.
If you have two elements of the same name within a Web page (or style sheet),
you can use the id attribute to distinguish between elements that have the same
name.
Note that there are some special rules for the value of the id attribute, it must:
• Begin with a letter (A.Z or a.z) and can then be followed by any number of
letters, digits (0.9), hyphens, underscores, colons, and periods.
• Remain unique within that document; no two attributes may have the same
value within that HTML document.
For example:
<h4 title="Hello HTML!">Titled Heading Tag Example</h4>
Now try to bring your cursor over "Titled Heading Tag Example" and see the result.
The value of the attribute may also be a space-separated list of class names. For
example:
The style attribute allows you to specify rules within the element.
For example:
<face= “arial” color= “FF0000”>Some text...</font>
Generic Attributes:
Here's a table of some other attributes that are readily usable with many of HTML's
tags.
Instructions: Create a Web page that features the text below. Copy the whole text
and apply the specified format. Save your work as practice.html.
FORMAT
1. Web page title “HTML Newbie”
2. Body background color is light green
3. LABORATORY RULES AND REGULATIONS: Font: Times New Roman, Size:
15, Color: blue, align center
• Pop-up title=”IFSU-CCS”
20
Learning Outcome:
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
Example:
Hello<br>
You come most carefully upon your hour.<br>
Thanks<br >
Mahnaz
Hello
You come most carefully upon your hour.
Thanks
Mahnaz
You can use <center> tag to put any content in the center of the page or any table cell.
Example:
HTML COMMENTS
Comments are piece of code which is ignored by any web browser. It is good
practice to comment your code, especially in complex documents, to indicate sections
of a document, and any other notes to anyone looking at the code. Comments help
you and others understand your code.
HTML Comment lines are indicated by the special beginning tag <!-- and ending
tag --> placed at the beginning and end of EVERY line to be treated as a comment.
Comments do not nest, and the double-dash sequence "--" may not appear
inside a comment except as part of the closing --> tag. You must also make sure that
there are no spaces in the start-of-comment string.
But following line is not a valid comment and will be displayed by the browser. This is
because there is a space between the left angle bracket and the exclamation mark.
< !-- This is commented out -->
Multiline Comments
You have seen how to comment a single line in HTML. You can comment
multiple lines by the special beginning tag <!-- and ending tag --> placed before the
first line and end of the last line to be treated as a comment.
<!--
This is a multiline comment <br />
and can span through as many as lines you like.
-->
25
Learning Outcomes
Example:
This contains <font face = “Times New Roman” color=“blue” >set font </font>
Horizontal Rules
The <hr > Element
Horizontal rules are used to visually break up sections of a document. The <hr>
tag creates a line from the current position in the document to the right margin
and breaks the line accordingly. Attributes, size and width are represented in
pixels, and noshade>
For example, you may want to give a line between two paragraphs as follows:
Anything that appears in a <u>...</u> element is displayed with underline, like the word
underlined here:
The content of a <sup> element is written in superscript; the font size used is the same
size as the characters surrounding it but is displayed half a characters height above
the other characters.
My Name is <em>Desiray</em>
My Name is Jerwin
The content of the <big> element is displayed one font size larger than the rest of the
text surrounding it.
The content of the <small> element is displayed one font size smaller than the rest of
the text surrounding it.
The <div> elements allow you to group together several elements to create sections
or subsections of a page.
For example, you might want to put all of the footnotes on a page within a <div>
element to indicate that all of the elements within that <div> element relate to the
footnotes. You might then attach a style to this <div> element so that they appear
using a special set of style rules.
29
Nesting Tags
- to combine the effect of one type of tag with another, simply enclose the container
tag in another container tag.
30
Date:______________ Score:______________
Instructions: Create a Web page that features the article below. Copy the whole
article and apply the specified format. Save your work as practice.html.
Practice means to do something often. Perfect means the best you can be. “Practice
Makes Perfect” means to do something often to become the best you can be.
Everything/Anything practiced will attain your own sort of perfection. Your perfection is
not your neighbor or friend’s perfection, thus, you are not like your friend or neighbor.
With the thought of perfection, the word “practice” is probably the next thing to occupy
your thoughts. How long did a student have to practice to reach 25 words per minute
in his Typing Lesson using the Proper Home Keys? Perfection is hard to come by. It
takes practice, time and mental or physical devotion. Therefore, is the well-known term
“Practice Makes Perfect” correct? Is it true that lots of practice will make perfection?
Some may argue that perfection isn't possible because there is ALWAYS room for
improvement but still, PRACTICE really helps a lot to do some sense of “perfection”.
(http://www.oppapers.com/essays/Does-Practice-Make-Perfect)
FORMAT
Title: Font: Times New Roman, Size: 5, Color: Red, Alignment: Center
Body: Font: Tahoma, Size: 3, Alignment: Left
1st Paragraph: Font Color Black, 2nd Paragraph: Font Color Green, Underline the
2nd Sentence
3rd Paragraph: Font Color: Orange. Underline all the “Practice Makes Perfect” found
on the article. Apply Bold to ALWAYS and PRACTICE on the third paragraph. URL:
Size: 2, Font: Tahoma, Color: Blue, Alignment: Right, Italic
Learning Outcomes:
HYPERLINK
Web pages can contain links that take you directly to other pages and even specific
parts of a given page. These links are known as hyperlinks.
Hyperlinks allow visitors to navigate between Web sites by clicking on words, phrases,
and images. Thus you can create hyperlinks using text or images available on your
any web page.
Linking Documents - The <a> Element
A link is specified using the <a> element. This element is called anchor tag as well.
Anything between the opening <a> tag and the closing </a> tag becomes part of the
link and a user can click that part to reach to the linked document.
Following is the simple syntax to use this tag.
Anchor Attributes:
Following are most frequently used attributes for <a> tag.
• href: specifies the URL of the target of a hyperlink. Its value is any valid
document URL, absolute or relative, including a fragment identifier or a
JavaScript code fragment.
• target: specify where to display the contents of a selected hyperlink. If set to
"_blank" then a new window will be opened to display the loaded page, if set to
"_top" or "_parent" then same window will be used to display the loaded
document, if set to "_self" then loads the new page in current window. By default
its "_self".
32
• name & id: attributes places a label within a document. When that label is used
in a link to that document, it is the equivalent of telling the browser to goto that
label.
• title: attribute lets you specify a title for the document to which you are linking.
The value of the attribute is any string, enclosed in quotation marks. The
browser might use it when displaying the link, perhaps flashing the title when
the mouse passes over the link.
A Simple Example:
Now we will learn how to use images to create hyper links. See example below:
Instructions: Create a Web page which contains 4 short stories. Every story provides
link for user to access the whole story content. Save your project as story.html. Refer
on the sample and specification below.
_______________________
34
Instructor’s Signature
Learning Outcomes
• define list item, unordered list, ordered list and definition list;
• identify and explain the different tags and attributes of HTML list;
• differentiate ordered list and unordered list;
• demonstrate the use of list tag and attributes using ordered and
unordered list;
• create a simple webpage using HTML list.
HTML LIST
You can list out your items, subjects or menu in the form of a list. HTML gives you
three different types of lists.
• <ul> - An unordered list. This will list items using bullets
• <ol> - A ordered list. This will use different schemes of numbers to list your
items
• <dl> - A definition list. This arranges your items in the same way as they are
arranged in a dictionary.
<center>
<h2>Movie List</h2>
</center>
<ul>
<li>Ram Teri Ganga Meli</li>
<li>Mera Naam Jocker</li>
<li>Titanic</li>
35
Movie List
You can use type attribute to specify the type of bullet you like. By default it is a disc.
Following are the possible way:
<center>
<h2>Movie List</h2>
</center>
<ol>
<li>Ram Teri Ganga Meli</li>
<li>Mera Naam Jocker</li>
<li>Titanic</li>
<li>Ghost in the ship</li>
</ol>
36
Movie List
You can use type attribute to specify the type of numbers you like. By default it is a
generic numbers. Following are the other possible way:
You can use start attribute to specify the beginning of any index. By default it is a first
number or character. In the following example index starts from 5:
<center>
<h2>Movie List</h2>
</center>
<ol start="5">
Output
<li>Ram Teri Ganga Meli</li>
Movie ListNaam Jocker</li>
<li>Mera
<li>Titanic</li>
5. Ram
<li>Ghost in Teri Ganga Meli
the ship</li>
6. Mera Naam Jocker
</ol>
7. Titanic
8. Ghost in the ship
37
Instructions: Create a Web page that displays the ingredients and instructions on
how to cook a featured recipe. Save your work as recipe.html. Refer on the sample
below.
Chicken-Pork Adobo
I. Ingredients:
• 1/2 kilo pork cut in cubes + 1/2 kilo chicken, cut into pieces or
• choice of either 1 kilo of pork or 1 kilo of chicken
• 1 head garlic, minced
• 1/2 yellow onion, diced
• 1/2 cup soy sauce
• 1 cup vinegar
• 2 cups of water
• 1 teaspoon paprika
• 5 laurel leaves (bay leaves)
• 4 tablespoons of cooking oil or olive oil
• 2 tablespoons cornstarch
• Salt and pepper to taste
• 3 tablespoons water
WEB SYSTEMS AND TECHNOLOGIES
3. Remove the pork and chicken from the sauce pan and on another pan, heat
cooking oil and brown the pork and chicken for a few minutes.
4. Mix the browned pork and chicken back to the sauce and add cornstarch
dissolved in water to thicken.
5. Add salt and/or pepper if desired
6. Bring to a boil then simmer for an additional 5 minutes.
7. Serve hot with the adobo gravy and rice.
_____________________________________________________________________
________________________
Instructor’s Signature
WEB SYSTEMS AND TECHNOLOGIES
Learning Outcomes:
HTML TABLES
Tables are very useful to arrange in HTML and they are used very frequently by almost
all web developers. Tables are just like spreadsheets and they are made up of rows
and columns.
You will create a table in HTML by using <table> tag. Inside <table> element the table
is written out row by row. A row is contained inside a <tr> tag, which stands for table
row. And each cell is then written inside the row element using a <td> tag, which stands
for table data.
Example:
<table border="1">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
This will produce following result:
<table border="1">
<tr>
<th>Name</th>
<th>Salary</th>
</tr>
<tr>
<td>Ramesh Raman</td>
<td>5000</td>
</tr>
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr>
</table>
This will produce following result. You can see its making heading as a bold one:
Name Salary
Name Salary
Ramesh Raman 5000
Shabbir Hussein 7000
<table border="1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr><td rowspan="2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr>
<tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr>
<tr><td colspan="3">Row 3 Cell 1</td></tr>
</table>
Tables Backgrounds
You can set table background using of the following two ways:
• Using bgcolor attribute - You can set background color for whole table or just
for one cell.
• Using background attribute - You can set background image for whole table or
just for one cell.
NOTE: You can set border color also using bordercolor attribute.
Here is an example of using bgcolor attribute:
WEB SYSTEMS AND TECHNOLOGIES
Row 3 Cell 1
<table border="1">
<caption>This is the caption</caption>
<tr>
<td>row 1, column 1</td><td>row 1, columnn 2</td>
</tr>
</table>
<tr>
...more rows here containing four cells...
</tr>
</tbody>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
<tr>
...more rows here containing four cells...
</tr>
</tbody>
</table>
Nested Tables
You can use one table inside another table. Not only tables you can use almost all the
tags inside table data tag <td>.
Following is the example of using another table and other tags inside a table cell.
<table border="1">
<tr>
<td>
<table border="1">
<tr>
<th>Name</th>
<th>Salary</th>
</tr>
<tr>
<td>Ramesh Raman</td>
<td>5000</td>
</tr>
WEB SYSTEMS AND TECHNOLOGIES
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr>
</table>
</td>
<td>
<ul>
<li>This is another cell</li>
<li>Using list inside this cell</li>
</ul>
</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
Instructions: Create a Web page of 12-month calendar. Use current month as your
reference. Save your work as monthly_calendar.html. Refer on the sample below.
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
________________________
Instructor’s Signature
WEB SYSTEMS AND TECHNOLOGIES
Learning Outcomes
• Each frameset defines a set of rows or columns. If you define frames by using
rows then horizontal frames are created. If you define frames by using columns
then vertical frames are created.
• The values of the rows/columns indicate the amount of screen area each
row/column will occupy.
• Each frame is indicated by <frame> tag and it defines what HTML document to
put into the frame.
Example:
Following is the example to create three horizontal frames:
<html>
<head>
<title>Frames example</title>
</head>
<frameset rows="10%,80%,10%">
<frame src="/html/top_frame.htm" />
<frame src="/html/main_frame.htm" />
<frame src="/html/bottom_frame.htm" />
<noframes>
<body>
Your browser does not support frames.
</body>
</noframes>
</frameset>
</html>
Following are important attributes of <frameset> and should be known to you to use
frameset.
• cols: specifies how many columns are contained in the frameset and the size
of each column. You can specify the width of each column in one of four ways:
WEB SYSTEMS AND TECHNOLOGIES
• rows: attribute works just like the cols attribute and can take the same values,
but it is used to specify the rows in the frameset. For example to create two
horizontal frames, use rows="10%, 90%". You can specify the height of each
row in the same way as explained above for columns.
• border: attribute specifies the width of the border of each frame in pixels. For
example border="5". A value of zero specifies that no border should be there.
The <frame> element indicates what goes in each frame of the frameset. The <frame>
element is always an empty element, and therefore should not have any content,
although each <frame> element should always carry one attribute src, to indicate the
page that should represent that frame.
From the above example, lets take small snippet:
Following are important attributes of and should be known to you to use frames.
WEB SYSTEMS AND TECHNOLOGIES
• src: indicates the file that should be used in the frame. Its value can be any
URL. For example, src="/html/top_frame.htm" will load an HTML file avaible in
html directory.
• frameborder: attribute specifies whether or not the borders of that frame are
shown; it overrides the value given in the frameborder attribute on the
<frameset> element if one is given, and the possible values are the same. This
can take values either 1 (yes) or 0 (no).
• marginwidth: allows you to specify the width of the space between the left and
right of the frame's borders and the frame's content. The value is given in pixels.
For example marginwidth="10".
• marginheight: allows you to specify the height of the space between the top
and bottom of the frame's borders and its contents. The value is given in pixels.
For example marginheight="10".
• noresize: By default you can resize any frame by clicking and dragging on the
borders of a frame. The noresize attribute prevents a user from being able to
resize the frame. For example noresize="noresize".
• scrolling: controls the appearance of the scrollbars that appear on the frame.
This takes values either "yes", "no" or "auto". For example scrolling="no" means
it should not have scroll bars.
One of the most popular uses of frames is to place navigation bars in one frame and
then load the pages with the content into a separate frame.
As you have already seen, each <frame> element can carry the name attribute to give
each frame a name. This name is used in the links to indicate which frame the new
page should load into. Consider this very simple example; create following content in
index.htm file:
WEB SYSTEMS AND TECHNOLOGIES
There are two columns in this example. The first is 200 pixels wide and will
contain the navigation bar. The second column or frame will contain the main part of
the page. The links on the left side navigation bar will load pages into the right side
main page.
The target attribute can also take the attribute values listed in the table that follows.
WEB SYSTEMS AND TECHNOLOGIES
Instructions: Create a Web page that has 3 frames. Link the Activities and Display in
the last Page. Save your work as frames.html.
Sample Output:
My Laboratory Activities
Activity 1
Activity 2
Activity 3
Activity 4
Activity 5
FORMAT:
• The row is 20% and 80%
• The column is 10% and 90%
• Put background color of your choice.
• The frameborder is 1
• In the first frame put “My Laboratory Activities” Font= Arial, size=34 name it
“First_page”
• In the second frame at the left side, link all your activities and name it
“Second_page”
• In the last frame name it “Main_page and Target to open all the activities
here.
You will be graded based on the following criteria
________________________
Instructor’s Signature
WEB SYSTEMS AND TECHNOLOGIES
Learning Outcomes:
• Define Forms;
• identify and explain tag and attributes of HTML forms;
• demonstrate tag and attributes of HTML forms by giving and showing
examples;
• apply the HTML forms tag and attributes in creating HTML document.
HTML Forms
<form>
input elements
</form>
Text Fields
<input type="text"> defines a one-line input field that a user can enter text into:
WEB SYSTEMS AND TECHNOLOGIES
<form>
First name: <input type=”text” name=”firstname”><br>
Last name: <input type=”text” name=”lastname”>
</form>
Top of Form
Firstname:
Last name:
Bottom of Form
Note: The form itself is not visible. Also note that the default width of a text field is 20
characters.
Password Field
<form>
Password: <input type="password" name="pwd">
</form>
Password:
Note: The characters in a password field are masked (shown as asterisks or circles).
Radio Buttons
<input type="radio"> defines a radio button. Radio buttons let a user select ONLY ONE
of a limited number of choices:
<form>
<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female
</form>
Male
Female
WEB SYSTEMS AND TECHNOLOGIES
Checkboxes
<form>
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>
I have a bike
I have a car
Submit Button
<input type="submit"> defines a submit button.
A submit button is used to send form data to a server. The data is sent to the page
specified in the form's action attribute. The file defined in the action attribute usually
does something with the received input:
<form name="input" action="demo_form_action.asp" method="get">
Username: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
Submit
Username:
Bottom of Form
If you type some characters in the text field above, and click the "Submit" button, the
browser will send your input to a page called "demo_form_action.asp". The page will
show you the received input.
WEB SYSTEMS AND TECHNOLOGIES
Instructions: Create a Web page of your information using FORMS. Save your work
as forms.html.
Sample Output
___________________________
Instructor’s Signature
WEB SYSTEMS AND TECHNOLOGIES
Learning Outcomes:
CSS Syntax
CSS Example
A CSS declaration always ends with a semicolon, and declaration groups are
surrounded by curly braces:
p {color:red;text-align:center;}
To make the CSS code more readable, you can put one declaration on each line,
like this:
Example
p{
color: red;
text-align: center;
}
WEB SYSTEMS AND TECHNOLOGIES
CSS Comments
Comments are used to explain your code, and may help you when you edit
the source code at a later date. Comments are ignored by browsers.
A CSS comment starts with /* and ends with */. Comments can also span
multiple lines:
Example
p{
color: red;
/* This is a single-line comment */
text-align: center;
}
/* This is
a multi-line
comment */
CSS Selectors
Example
p{
text-align: center;
color: red;
}
WEB SYSTEMS AND TECHNOLOGIES
The id Selector
The id selector uses the id attribute of an HTML tag to find the specific
element.
An id should be unique within a page, so you should use the id selector
when you want to find a single, unique element.
To find an element with a specific id, write a hash character, followed by
the id of the element.
The style rule below will be applied to the HTML element with id="para1":
Example
#para1 {
text-align: center;
color: red;
}
Example
.center {
text-align: center;
color: red;
}
You can also specify that only specific HTML elements should be
affected by a class.
In the example below, all p elements with class="center" will be center-
aligned:
Example
p.center {
text-align:center;
color:red;
}
}
WEB SYSTEMS AND TECHNOLOGIES
Grouping Selectors
In style sheets there are often elements with the same style:
h1 {
text-align: center;
color: red;
}
h2 {
text-align: center;
color: red;
}
p{
text-align: center;
color: red;
}
In the example below we have grouped the selectors from the code above:
Example
h1, h2, p {
text-align: center;
color: red;
}
When a browser reads a style sheet, it will format the document according to the
information in the style sheet.
An external style sheet is ideal when the style is applied to many pages. With an
external style sheet, you can change the look of an entire Web site by changing just
one file.
Each page must include a link to the style sheet with the <link> tag. The <link> tag
goes inside the head section:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
An external style sheet can be written in any text editor. The file should not contain
any html tags. The style sheet file must be saved with a .css extension. An example
of a style sheet file is shown below:
"myStyle.css":
hr {color: sienna;}
p {margin-left: 20px;}
body {background-image: url("images/background.gif");}
Do not add a space between the property value and the unit (such as margin-left:
20 px;). The correct way is: margin-left: 20px;
An internal style sheet should be used when a single document has a unique style.
You define internal styles in the head section of an HTML page, inside the <style>
tag, like this:
<head>
<style>
hr {color: sienna;}
p {margin-left: 20px;}
body {background-image: url("images/background.gif");}
</style>
</head>
WEB SYSTEMS AND TECHNOLOGIES
Inline Styles
An inline style loses many of the advantages of a style sheet (by mixing content with
presentation). Use this method sparingly!
To use inline styles, add the style attribute to the relevant tag. The style attribute can
contain any CSS property. The example shows how to change the color and the left
margin of a paragraph:
<p style="color:sienna;margin-left:20px;">This is a paragraph.</p>
If some properties have been set for the same selector in different style sheets, the
values will be inherited from the more specific style sheet.
For example, assume that an external style sheet has the following properties for the
h3 selector:
h3 {
color: red;
text-align: left;
font-size: 8pt;
}
then, assume that an internal style sheet also has the following properties for the h3
selector:
h3 {
text-align: right;
font-size: 20pt;
}
If the page with the internal style sheet also links to the external style sheet the
properties for the h3 element will be:
color: red;
text-align: right;
font-size: 20pt;
The color is inherited from the external style sheet and the text-alignment and the
font-size is replaced by the internal style sheet.
WEB SYSTEMS AND TECHNOLOGIES
Tip: Even multiple external style sheets can be referenced inside a single HTML
document.
Cascading order
What style will be used when there is more than one style specified for an HTML
element?
Generally speaking we can say that all the styles will "cascade" into a new "virtual"
style sheet by the following rules, where number four has the highest priority:
1. Browser default
2. External style sheet
3. Internal style sheet (in the head section)
4. Inline style (inside an HTML element)
So, an inline style (inside an HTML element) has the highest priority, which means
that it will override a style defined inside the <head> tag, or in an external style
sheet, or in a browser (a default value).
Note: If the link to the external style sheet is placed after the internal style
sheet in HTML <head>, the external style sheet will override the internal
style sheet!
• background-color
• background-image
• background-repeat
• background-attachment
• background-position
Background Color
Example
body {
background-color: #b0c4de;
}
In the example below, the h1, p, and div elements have different background colors:
Example:
h1 {
background-color: #6495ed;
}
p{
background-color: #e0ffff;
}
div {
background-color: #b0c4de;
}
Background Image
Example
body {
background-image: url("paper.gif");
}
Below is an example of a bad combination of text and background image. The text is
almost not readable:
WEB SYSTEMS AND TECHNOLOGIES
Example
body {
background-image: url("bgdesert.jpg");
}
Some images should be repeated only horizontally or vertically, or they will look
strange, like this:
Example
body {
background-image: url("gradient.png");
}
If the image is repeated only horizontally (repeat-x) and vertically (repeat-y), the
background will look better:
Example
body {
background-image: url("gradient.png");
background-repeat: repeat-x;
}
Note: When using a background image, use an image that does not disturb
the text.
Example
body {
background-image: url("img_tree.png");
background-repeat: no-repeat;
}
In the example above, the background image is shown in the same place as the text.
We want to change the position of the image, so that it does not disturb the text too
much.
Example
body {
background-image: url("img_tree.png");
background-repeat: no-repeat;
background-position: right top;
}
As you can see from the examples above, there are many properties to consider
when dealing with backgrounds. To shorten the code, it is also possible to specify all
the properties in one single property. This is called a shorthand property.
Example
body {
background: #ffffff url("img_tree.png") no-repeat right top;
}
When using the shorthand property the order of the property values is:
• background-color
• background-image
• background-repeat
• background-attachment
• background-position
It does not matter if one of the property values is missing, as long as the ones that
are present are in this order.
WEB SYSTEMS AND TECHNOLOGIES
Property Description
background Sets all the background properties in one declaration
TEXT FORMATTING
This text is styled with some of the text formatting properties. The heading uses the
text-align, text-transform, and color properties. The paragraph is indented, aligned,
and the space between characters is specified.
Text Color
Look at CSS Color Values for a complete list of possible color values.
Example
body {
color: blue;
}
h1 {
color: #00ff00;
}
h2 {
color: rgb(255,0,0);
}
WEB SYSTEMS AND TECHNOLOGIES
Note: If you define the color property, you must also define the background-color
property.
Text Alignment
The text-align property is used to set the horizontal alignment of a text. Text can be
centered, or aligned to the left or right, or justified. When text-align is set to "justify",
each line is stretched so that every line has equal width, and the left and right
margins are straight (like in magazines and newspapers).
Example
h1 {
text-align: center;
}
p.date {
text-align: right;
}
p.main {
text-align: justify;
}
Text Decoration
Example
a{
text-decoration: none;
}
Example
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
WEB SYSTEMS AND TECHNOLOGIES
h3 {
text-decoration: underline;
}
Text Transformation
Example
p.uppercase {
text-transform: uppercase;
}
p
.lowercase {
text-transform: lowercase;
}
p.capitalize {
text-transform: capitalize;
}
Text Indentation
The text-indent property is used to specify the indentation of the first line of a text.
Example
p{
text-indent: 50px;
}
WEB SYSTEMS AND TECHNOLOGIES
Property Description
color Sets the color of text
unicode-bidi Used together with the direction property to set or return whether the
text should be overridden to support multiple languages in the same
document
CSS Font
CSS font properties define the font family, boldness, size, and the style of a text.
• generic family - a group of font families with a similar look (like "Serif" or
"Monospace")
WEB SYSTEMS AND TECHNOLOGIES
• font family - a specific font family (like "Times New Roman" or "Arial")
Serif Times New Roman Serif fonts have small lines at the ends on
Georgia some characters
Note: On computer screens, sans-serif fonts are considered easier to read than serif fonts.
Font Family
The font family of a text is set with the font-family property. The font-family property
should hold several font names as a "fallback" system. If the browser does not
support the first font, it tries the next font. Start with the font you want, and end with a
generic family, to let the browser pick a similar font in the generic family, if no other
fonts are available.
Note: If the name of a font family is more than one word, it must be in quotation
marks, like: "Times New Roman".
For more commonly used font combinations, look at our Web Safe Font
Combinations.
Font Style
The font-style property is mostly used to specify italic text.
Example
p.normal {
font-style: normal;
}
p.italic {
font-style: italic;
}
p.oblique {
font-style: oblique;
}
Font Size
Being able to manage the text size is important in web design. However, you should
not use font size adjustments to make paragraphs look like headings, or headings
look like paragraphs. Always use the proper HTML tags, like <h1> - <h6> for
headings and <p> for paragraphs.The font-size value can be an absolute, or relative
size.
Absolute size:
• Sets the text to a specified size
• Does not allow a user to change the text size in all browsers (bad for
accessibility reasons)
• Absolute size is useful when the physical size of the output is known
Relative size:
Note: If you do not specify a font size, the default size for normal text, like
paragraphs, is 16px (16px=1em).
Setting the text size with pixels gives you full control over the text size:
Example
h1 {
font-size: 40px;
}
WEB SYSTEMS AND TECHNOLOGIES
h2 {
font-size: 30px;
}
p{
font-size: 14px;
}
The example above allows Internet Explorer 9, Firefox, Chrome, Opera, and Safari
to resize the text.
Note: The example above does not work in IE, prior version 9.
The text can be resized in all browsers using the zoom tool (however, this resizes
the entire page, not just the text).
To avoid the resizing problem with older versions of Internet Explorer, many
developers use em instead of pixels.
1em is equal to the current font size. The default text size in browsers is 16px. So,
the default size of 1em is 16px.
The size can be calculated from pixels to em using this formula: pixels/16=em
Example
h1 {
font-size: 2.5em; /* 40px/16=2.5em */
}
h2 {
font-size: 1.875em; /* 30px/16=1.875em */
}
p{
font-size: 0.875em; /* 14px/16=0.875em */
}
In the example above, the text size in em is the same as the previous example in
pixels. However, with the em size, it is possible to adjust the text size in all browsers.
Unfortunately, there is still a problem with older versions of IE. The text becomes
larger than it should when made larger, and smaller than it should when made
smaller.
WEB SYSTEMS AND TECHNOLOGIES
The solution that works in all browsers, is to set a default font-size in percent for the
<body> element:
Example
body {
font-size: 100%;
}
h1 {
font-size: 2.5em;
}
h2 {
font-size: 1.875em;
}
p{
font-size: 0.875em;
}
Property Description
Styling Links
Links can be styled with any CSS property (e.g. color, font-family, background, etc.).
In addition, links can be styled differently depending on what state they are in.
/* visited link */
a:visited {
color: #00FF00;
}
/* selected link */
a:active {
color: #0000FF;
}
When setting the style for several link states, there are some order rules:
Example
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
WEB SYSTEMS AND TECHNOLOGIES
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
Background Color
Example
a:link {
background-color: #B2FF99;
}
a:visited {
background-color: #FFFF85;
}
a:hover {
background-color: #FF704D;
}
a:active {
background-color: #FF704D;
}
Table Borders
To specify table borders in CSS, use the border property.
The example below specifies a black border for table, th, and td elements
Example
table, th, td {
border: 1px solid black;
}
Notice that the table in the example above has double borders. This is because both
the table and the th/td elements have separate borders.
To display a single border for the table, use the border-collapse property.
WEB SYSTEMS AND TECHNOLOGIES
Collapse Borders
The border-collapse property sets whether the table borders are collapsed into a
single border or separated:
Example
table {
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
Example
table {
width: 100%;
}
th {
height: 50px;
}
Example
td {
text-align: right;
}
The vertical-align property sets the vertical alignment, like top, bottom, or middle:
Example
td {
height: 50px;
vertical-align: bottom;
}
WEB SYSTEMS AND TECHNOLOGIES
Table Padding
To control the space between the border and content in a table, use the padding
property on td and th elements:
Example
td {
padding: 15px;
}
Table Color
The example below specifies the color of the borders, and the text and background
color of th elements:
Example
table, td, th {
border: 1px solid green;
}
th {
background-color: green;
color: white;
}
Navigation Bars
Having easy-to-use navigation is important for any web site.
With CSS you can transform boring HTML menus into good-looking navigation bars.
1. Using HTML create an html document that will be used to contain your
navigation bar.
2. Using Unordered List create a list of your links in navigation bar
3. Apply class in the UL tag.
4. Create an external CSS document to format the contents of the Unordered
list that you have created.
5. Inside the CSS file type
WEB SYSTEMS AND TECHNOLOGIES
*{
Margin:0px;
Padding:0px;
}
Ex:
.navmenu li:hover > a{
background-color:green;
}
14. Next step, we will going to change the color of the currernt hovering position
from its main bar.
Ex:
.navmenu li:hover a:hover{
background-color:yellow;
}
15. Next step is to hide the sub menu and arrange the position.
Ex:
.navmenu ul.sub1{
display:none;
position:absolute;
top:26px;
left:0px;
}
16. Last Step… After hiding the sub menu in step 15, we will going to display the
submenu upon the action of mouse hovering.
Ex:
.navmenu li:hover .sub1{
display:block;
}
WEB SYSTEMS AND TECHNOLOGIES
________________________
Instructor’s Signature
WEB SYSTEMS AND TECHNOLOGIES
REFERENCES
Book/s:
Paul McFedies (2018) Web Coding & Development All-in-One for Dummies
David McMahon (N.D) HTML and CSS Crash Course – Learn HTML and CSS
with easy to follow - step-by-step tutorials
Jerwin S. Taguinod. Web Systems and Technologies. Unpublished.
Online Resources: