Professional Documents
Culture Documents
Lecture One
Introduction of the course
Course Description
1. HTML
2. CSS
3. JavaScript
Online References:
www.w3schools.com
www.Coursera.org
Implementation
Adobe Dream-Weaver Cs4
Microsoft FrontPage
Note-Pad Editor
% 30
Project One % 10
Project Two 20
Attendance 5%
Discussion 5%
Final Exam % 30
19
Chapter Two
Understanding HTML
(HyperText Markup Language)
A web page
A Web Page is a document containing text; graphics
(images) and other embedded media, e.g. sound; and links
(pointers) to other web pages .
The links are called hyperlinks and a special markup
language called HTML (HyperText Markup Language) was
created so that these links could be written as strings of text.
(http://en.wikipedia.org/wiki/HTML)
A web page that points to other web pages is said to use
hypertext.
One of the pages of a web site is denoted the home page.
Hypertext navigation is a major component of web page
design.
The start tag, the content and the end tag form
an element. Tags mainly mark areas of the web
page that are to be formatted. This is why
HTML is called a markup language .
Key Terms
Headings
Often a web page needs to include headings
in larger, bolder text that stands out.
To create headings, use:
<h#>Heading text</h#> and replace # with
a number from 1 to 6. The text inside will be
bold and usually larger h1 gives the
largest headings - and surrounded by empty
lines.
The Figure below shows how the following lines of HTML code appear in a browser:
<h1>This is
an
h1
heading.</hl>
<h2>This is
an
h2
heading.</h2>
<h3>This is
an
h3
heading.</h3>
<h4>This is
an
h4
heading.</h4>
<h5>This is
an
h5
heading.</h5>
<h6>This is
an
h6
heading.</h6>
PRACTICE
Typography (Typesetting)
As a rule of thumb, paragraph text should use
a sans serif font such as Arial and
headlines should use a serif font such as
Times New Roman - the opposite of what is
used for printed text.
Explore font settings at
www.typetester.maratz.com.
ABCDEF
FFFF00
FEDCBA
336699
773466
112233
FF1122
666666
0033FF
663333
AABBAA
00FF00
800800
FF6600
008008
993366
020769
123456
111111
654321
Black
White
Red
Green
Marron
Purple
Navy
Blue
Teal
Lime
Gray
Silver
Olive
Aqua
Fuchsia
Yellow
BGCOLOR
<BODY BGCOLOR="#FFFFFF>
...
</BODY>
Images
To include an image on a web page use <img
src="image1.gif" alt="first image" width="70"
height="70/>
The attribute alt allows a text description of
the image to be used in place of the image in
text-only browsers.
The width and height attributes set the
image's display size in pixels.
Eng. Mohamed Adam isak
BACKGROUND
<BODY BACKGROUND="image.jpg">
...
</BODY>
10
Links
Links, or hyperlinks, are the hooks that make
it possible to navigate to information without
knowing the precise details of its location or
identity.
For example, you may not know the name of
a file on www. educational-computing.co.uk
that contains an article you want to read, but
you can still get to it by clicking on the
appropriate link.
11
Will display in a web browser as Click here To visit Imam shafi university!
12
13
If you click on the link, it will take you to the anchor named top.
14
<a href="">
<a href="mailto:">
<a name="name">
<a href="#name">
15
Ordered List
<OL>
<li> Task 1 </li>
<li> Task 2 </li>
<li> Task 3 </li>
</OL>
Here is the result:
1.Task 1
2.Task 2
3.Task 3
16
Unordered Lists
Unordered Lists are the same as ordered lists
but the browser does not automatically number
the list items.
Each item starts with a symbol, or dingbat,
such as filled square or filled circle.
An unordered list is created in the same way
as an ordered list, but the list is enclosed by
<u1> and </u1 > instead of <01> and </01 >.
Eng. Mohamed Adam isak
17
Text related
<small></small>Small text
<big></big>Big text; not present in HTML5
because text size is better controlled by CSS
<sup></sup>Superscript text
<sub></sub>Subscript text
<em></em> or <i></i>Emphasized (italic) text
<strong></strong> or <b></b>Strong
(boldface) text
Eng. Mohamed Adam isak
18
PRACTICE
Eng. Mohamed Adam isak
19
Chapter 3
Understanding
Cascading Style Sheets
(CSS)
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
When tags like <font>, and color attributes were added to the HTML 3.2 specification, it
started a nightmare for web developers. Development of large web sites, where fonts and
color information were added to every single page, became a long and expensive process.
To solve this problem, the World Wide Web Consortium (W3C) created CSS.
In HTML 4.0, all formatting could be removed from the HTML document, and stored in a
separate CSS file.
Until recently, HTML was used to specify the structure and style of web pages. Every piece
of text has structure. Unfortunately, HTML started to be used for style (presentational
effects) - basic formatting to create visual effects such as text colour and font size.
Using HTML for visual effects made web pages difficult to understand and edit.
The solution was cascading style sheets (CSS). CSS allows designers to control how a web
page will display in a web browser and separates this presentational information from the
web page content and its logical structure.
Presentational tags, such as the font tag, could be ditched and layout could be controlled
using CSS instead of tables.
One CSS may be written and applied to all the pages in a web site; this is an external style
sheet.
Style sheets are increasingly being used, together with HTML, for designing and creating
web pages.
Here are three benefits of using style sheets:
1.
Updating the look of a site is easier (If you change one style sheet, all related HTML
pages will change);
2.
3.
Less coding;
4.
5.
Selectors
Elements of an HTML page such as the paragraph element p must be selected to follow a
style rule. A style rule consists of three parts: a type selector, a property and a value:
selector {property: value}
The selector is normally the HTML tag you wish to style, the property is the attribute you
wish to change, and each property can take a value. The property and value are separated
by a colon and surrounded by curly brackets, or braces:
h1 {color : red}
Selectors
If the value is two or more words, put double quotes around it:
p {font-family: "sans serif"}
To specify more than one property, separate each property with a semicolon. The style rule
p {text-align: center; color: blue}
defines a centre-aligned paragraph with a blue text colour. Selectors may be grouped by
separating each selector with a comma. This is the way to group all header elements and
make them appear in red text:
h1, h2, h3, h4, h5, h6 {color: red}
A selector that is an HTML tag is known as a type selector. Type selectors target every
instance of an element.
CSS Syntax
A CSS rule has two main parts: a selector, and one or more declarations:
The following HTML shows the use of an embedded style sheet which contains the style rule
for the paragraph containing the text 'Hello World!'
10
11
CSS Activity
Examine the effect of using different embedded style sheets on a given web page. Now edit
the embedded style sheet to see its effect on the appearance of the web page.
12
An external style sheet is by far the best way of styling a web site.
A single external style sheet may be linked to each web page on a web site so that the
styling is consistent throughout the site.
Any changes that are made to the external style sheet apply to the whole web site.
Here are some style rules stored in the file MyStyles.css; note the extension .css
13
14
15
To apply MyStyles.css to a web page, the web page must contain a link reference in the
<head> section.
A link reference uses the tag <link/> with attributes rel, type and href.
Attribute type specifies that the style sheet has format CSS text, and
16
17
CSS Activity
Examine the effect of using different external style sheets on the same web page. Now edit
the external style sheet and see the effect of your edits on the appearance of the web page.
18
Class Selector
Class selectors can be used to select any HTML element that has a class attribute. Here is
the declaration for a class selector to embolden and colour text red:
.boldRed {color: red; font-weight: bold}
It can be applied in a web page to tags <h1> and <p>:
<h1 class = boldRed>Hello World!</hl>
<p class = boldRed>Hello World!</p>
If you want to be more restrictive, you can use class and type selectors together. Any type
selector can be used. The class boldRed can be made to apply inside paragraphs only by
changing the declaration as follows:
p.boldRed {color: red; font-weight: bold}
19
Block-level Elements
20
Block-level Elements
21
ID Selectors
The key difference between IDs and classes is that IDs identify a specific element and
therefore must be unique on the page - a specific ID can be used only once per document.
Classes mark elements as members of a group and can be used multiple times; a defined
style may be applied to multiple elements. An ID selector is used as follows with the attribute
id: <div id = "header">
There is just one header section per web page containing the logo and basic site-wide
information, so it makes sense to use an ID selector labelled "header" rather than a class
selector.
Eng. Mohamed Adam isak
22
ID Selectors
A typical web page is divided into several sections. Where more than one section serves a
similar purpose, it makes sense to use a common class selector for each, e.g. <div class =
"warning">.
Class selectors can be combined together in elements; for example, <div class ="redBold
underl ineA11" has two rules: the selector class redBold and the selector class
underlineA11. ID selectors cannot be combined this way. There may be times when a
declaration conflicts with another declaration. These conflicts are resolved using the
cascade rules. If a class selector and an ID selector are in conflict, the ID selector is chosen.
23
Inline Elements
Inline elements fit in with the flow of the document. Three examples are <span></span>,
<strong></strong> and <em></em>.
The HTML
<span style="color : red; font-size: 14pt">You can add coloured text</span>
produces
You can add coloured text
The HTML
<strong>Bold text</strong> produces Bold text
And the HTML
<em>Italicised text</em> produces italicised text
Other inline elements are <a></a>, the tag combination for inserting an anchor into a web
page and <mg />, the tag for inserting an image.
24
Comments
The comment tag is used to insert a comment into the source of a web page. A comment is
ignored by the browser. You can use comments to explain your web page source, which can
help you when you edit the source code at a later date. In external style sheets, comments
are set between /* and */. In HTML code, a comment is written like this:
25
Comments
26
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, an external style sheet has these properties for the h3 selector:
h3 {color:red; text-align:left; font-size:8pt;}
And an internal style sheet has these 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
h3 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.
27
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).
28
Description
background
background-attachment
background-color
background-image
background-position
background-repeat
29
Description
color
direction
letter-spacing
line-height
text-align
text-shadow
white-space
word-spacing
30
Description
font
font-family
font-size
font-style
font-variant
font-weight
31
Quiz
32
Chapter 6
Using tables to display
information - HTML
<th colspan=2>Description</th>
Spanning is the process of forcing a cell to stretch across more than one row or column of a
table. The colspan attribute causes a cell to span across multiple columns; rowspan has the
same effect on rows.
Frameset (1/2)
<frameset rows="20,*">
<frame src="SudanPHD.pdf" scrolling="no">
<frame src="MalaysiaPHD.pdf">
</frameset>
</frameset>
Frameset (2/2)
HTML alignment
<html dir="rtl">
<html dir=ltr">
Quiz
Design the following table using HTML
Chapter 8
Working with Multimedia
Image Software
Download and install GIMP from http://www.gimp.org. This fully functional graphics program
is completely free and is used to perform the actions related to image creation.
If GIMP doesnt suit you, consider downloading the evaluation version of Adobe Photoshop
or Corel DRAW. For photo manipulation only, there are many free options, all with helpful
features such as:
1. Googles Picasa, which is available free at http://picasa.google.com/, is one such
option.
2. Picnik (http://www.picnik.com/) is another.
Both of these programs are suited for editing images rather than creating them from scratch,
and Picasa is also oriented toward organizing your digital photograph collection.
MIME
. WAV Audioaudio/x-wav
. AU Audioaudio/basic
. MP3 Audioaudio/mpeg
. MIDI Audioaudio/midi
. WMA Audioaudio/x-ms-wma
. RealAudioaudio/x-pn-realaudio-plugin
. AVIvideo/x-msvideo
. WMVvideo/x-ms-wmv
. MPEG Videovideo/mpeg
. QuickTimevideo/quicktime
Tips
Chapter 16,17,18,19
Using JavaScript
JavaScript overview
JavaScript was developed by Netscape
Communications Corporation, the maker
of the Netscape web browser. JavaScript
was the first web scripting language to be
supported by browsers, and it is still by far
the most popular.
JavaScript functions
Here are a few of the things you can do with JavaScript:
1.
2.
3.
4.
5.
6.
7.
Internal JavaScript
<html>
<head>
<title>The Somali Society Site</title>
</head>
<body>
<p>Welcome to our site. Unfortunately, it is still under construction.</p>
<p>We last worked on it on this date:
<script type=text/javascript>
document.write(document.last updated)
</script>
</p>
</body>
</html>
External JavaScript
External scripts are supported by all modern browsers.
To use an external script we call it from inside the html
as follows:
<script type=text/javascript src=filename.js></script>
Youll be placing the JavaScript statements in a separate
file.
You can create the .js file using a text editor. It should
contain one or more JavaScript commands and only
JavaScriptdont include <script> tags, other HTML
tags, or HTML comments.
Save the .js file in the same directory as the HTML
documents that refer to it.
Example One
Comment line
Comment paragraph
Variables
Using strings
Using function
Return statement
Global variables
Local variables
Math functions
If statement
Comparisons
==
>
<
>=
<=
If else
If else
Nesting if
Complex condition
Complex condition
Switch case
For loop
While
Do while
Event handlers
On mouse over
On mouse out
References of JavaScript
http://javascript.internet.com
http://www.dynamicdrive.com
www.w3.org
Chapter 26
Working with Web-Based
Forms
Checkbox
<select name=vote>
<option
value=yes>Yes</option>
<option
value=no>No</option>
</select>
<textarea name=comments>
We like Somali Country.</textarea>
Option
<form>
<select name="country">
<option value="So">Somalia
<option value="sa">Saudi arabia
<option value="ua">Emirates
<option value="qt">Qatar
<option value="bh">Bahrain
<option value="om">Oman
</select>
<input type="submit">
</form>
Radio button
<form>
Age : <br>
<input type="radio" name="age" value="17"> 10 - 17<br>
<input type="radio" name="age" value="50"> 18 - 50<br>
<input type="radio" name="age" value="100"> 51 - 100<br>
Gender : <br>
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female<br>
<input type="submit">
</form>
<body>
<h1>Form Display Example</h1>
<p>Enter the following information. When you
press the Display
button, the data you entered will be displayed in
a pop-up.</p>
<form name=form1 method=get action=>
<p>NAME: <input type=text name=name
size=50 /></p>
<p>ADDRESS: <input type=text
name=address size=50 /></p>
<p>PHONE: <input type=text name=phone
size=50 /></p>
<p><input type=button value=Display
onclick=display(); /></p>
</form>
</body>
</html>
Chapter 28
Helping people find your web page
Google
Visit http://www.google.com/addurl/, enter the
address of your site and a brief description, and
then enter the squiggly verification text, called a
CAPTCHA, (or Completely Automated Public
Turing test to tell Computers and Humans Apart)
shown on the page.
Then click the Add URL button to add your site
to Google.
Yahoo! Search
Visit
http://siteexplorer.search.yahoo.com/subm
it, click on Submit a Website or Webpage,
enter the address of your site, and then
click the Submit URL button.
Bing
Visit
http://www.bing.com/docs/submit.aspx,
enter the verification text, enter the
address of your site, and then click the
Submit URL button.
Using Meta
Most major search engines look at <meta /> tags to provide them with a
short description of your page and some keywords to identify what your
page is about.
<meta name=description content=Somali studies center. /
<meta name=keywords content=Somali center, research center, Somali
studies />
The first tag in this example ensures that the search engine has an accurate
description of the page to present on its search results list.
The second <meta /> tag slightly increases your pages ranking on the list
whenever any of your specified keywords are included in a search query.
Meta will be put before the closing </head> tag.
IT Reference website
www.it-ebooks.info