Internet Programming
Internet Programming
Internet Programming
LOGO
rada_khim@yahoo.com
1- Hypertext
Special instructions in HTML permit lines of
text to point (that is, link) to something else in
cyberspace. Such pointers are called
hyperlinks. Hyperlinks are the glue that holds
the World Wide Web together. In your Web
browser, hyperlinks usually appear in blue
and are underlined. When you click one, it
takes you somewhere else.
LOGO
rada_khim@yahoo.com
Hypertext or not, a Web page is a text file,
which means you can create and edit a
Web page in any application that creates
plain text (such as Notepad or TextEdit).
Some software tools offer fancy options
and applications to help you create Web
pages, but they generate the same text
files that you create with plain-text editors.
LOGO
rada_khim@yahoo.com
2- Markup
LOGO
rada_khim@yahoo.com
For example, look at the page below. You
can see how the page is made up and how it
is formatted by examining its underlying
HTML.
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
This page includes an image, a heading that
describes the page, several paragraphs
of text about one of your authors, and an
address block with links to a résumé and a
list of publications.
LOGO
rada_khim@yahoo.com
3- Website
A website, also written as Web site,[1] web
site, or simply site,[2] is a set of related Web
Pages containing content such as text,
images, video, audio, etc. A website is
hosted on at least one web server,
accessible via a network such as the Internet
or a private local area network through an
Internet address known as a Uniform
Resource Locator.
LOGO
rada_khim@yahoo.com
All publicly accessible websites collectively
constitute the World Wide Web.
LOGO
rada_khim@yahoo.com
4- Webpages
Webpages are accessed and transported
with the Hypertext Transfer Protocol (HTTP),
which may optionally employ encryption
(HTTP Secure, HTTPS) to provide security
and privacy for the user of the webpage
content. The user's application, often a web
browser, renders the page content according
to its HTML markup instructions onto a
display terminal.
LOGO
rada_khim@yahoo.com
5- URL
LOGO
rada_khim@yahoo.com
URLs are the standard addressing system
for Web resources. Each resource
(Web page, site, or individual file) has a
unique URL. URLs work a lot like your
postal address. See below, it identifies
the components of a URL.
LOGO
rada_khim@yahoo.com
Path
http://www.bun.com/developers/evengcentral/bios.html
LOGO
rada_khim@yahoo.com
6- Browser
LOGO
rada_khim@yahoo.com
The most common browser software titles on
the market are: Microsoft Internet Explorer,
Mozilla Firefox, Apple Computer's Safari,
and Opera. Browser availability depends on
the operating system your computer is using
(for example: Microsoft Windows, Linux,
Ubuntu, Mac OS…
LOGO
rada_khim@yahoo.com
HTML and XHTML
LOGO
rada_khim@yahoo.com
HTML is now enshrined in numerous
standard descriptions (specifications) from
the World Wide Web Consortium (W3C). The
last HTML specification was finalized in
1999.
LOGO
rada_khim@yahoo.com
When you put an X in front of HTML to get
XHTML, you get a new, improved version of
HTML based on the eXtensible Markup
Language (XML). XML is designed to work
and behave well with computers, software,
and the Internet.
LOGO
rada_khim@yahoo.com
The original formulation of HTML has some
irregularities that can cause heartburn for
software that reads HTML documents.
XHTML, on the other hand, uses an
extremely regular and predictable syntax
that’s easier for software to handle. XHTML
will replace HTML someday, but HTML
keeps on ticking.
LOGO
rada_khim@yahoo.com
2- Markup Concept
2.1- Elements
LOGO
rada_khim@yahoo.com
- Elements with content made up of a tag
pair and whatever content sits
between the opening and closing tag in the
pair
- Elements that insert something into the
page, using a single tag
LOGO
rada_khim@yahoo.com
Tag pairs
Elements that describe content use a tag
pair to mark the beginning and the
end of the element. Start and end tag pairs
look like this:
<tag>...</tag>
LOGO
rada_khim@yahoo.com
such as paragraphs, headings, tables, and
lists — always uses a tag pair:
The start tag (<tag>) tells the browser, “The
element begins here.”
LOGO
rada_khim@yahoo.com
For example:
<p>
A Macintosh oriented monthly magazine. By
1989 he had contributed to such publications
as LAN Times, Network World, Mac World,
and LAN Magazine.
</p>
LOGO
rada_khim@yahoo.com
Single tags
Elements that insert something into the page
are called empty elements (because they
enclose no content) and use just a single
tag, like this: <tag />
Images and line breaks insert something into
the HTML file, so they use one tag.
LOGO
rada_khim@yahoo.com
2.2- Nesting
LOGO
rada_khim@yahoo.com
The <ul> element specifies that the list is
unordered (bulleted).
The <li> elements mark each item in the
list.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
LOGO
rada_khim@yahoo.com
2.3- Attributes and Values
LOGO
rada_khim@yahoo.com
<img src=”images/header.gif” alt=”header
graphic” width=”794” height=”160” />
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Working With Text
LOGO
rada_khim@yahoo.com
1- Divisions
It’s normal for a web page to have natural
divisions according to the type of content
found in each area of the page. A few
common divisions or sections of a page
might include the navigation, the body copy,
the header, and the footer. The code used to
separate each section might look similar to
the following:
LOGO
rada_khim@yahoo.com
<body>
<div id="header">
Header content goes here.
</div>
<div id="bodyCopy">
Body copy goes here.
</div>
<div id="footer">
Footer content goes here.
</div>
</body>
LOGO
rada_khim@yahoo.com
2- Paragraph
LOGO
rada_khim@yahoo.com
<body>
<p>This is a paragraph. It’s a very simple
structure that you will use time and again in
your Web pages.</p>
<p>This is another paragraph. What could
be simpler to create?</p>
</body>
LOGO
rada_khim@yahoo.com
3- Heading
LOGO
rada_khim@yahoo.com
<body>
<h1>Headings</h1>
<h2>are</h2>
<h3>great</h3>
<h4>for</h4>
<h5>titles</h5>
<h6>and subtitles</h6>
</body>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
4- Formatting Text
LOGO
rada_khim@yahoo.com
4.1-Logical Format
LOGO
rada_khim@yahoo.com
you could use the dfn tag to tell the browser
the phrase “logical styles” should be
highlighted as a defined term.
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
4.2- Physical Format
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
5- Break
LOGO
rada_khim@yahoo.com
<body>
<h1>Shall I compare … to a summer’s day? </h1>
<p>
Shall I compare thee to a summer’s day? <br />
Thou art more lovely and more temperate. <br />
Rough winds do shake the darling buds of May,
<br />
</p>
</body>
LOGO
rada_khim@yahoo.com
6- Preformat
LOGO
rada_khim@yahoo.com
<body>
<pre>This is a paragraph with a lot of
white space thrown in for fun
(and as a test of course).
</pre>
</body>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Creating Lists
LOGO
rada_khim@yahoo.com
Numbered lists
Bulleted lists
Definition lists
LOGO
rada_khim@yahoo.com
1- Numbered lists
LOGO
rada_khim@yahoo.com
<body>
<h1>Things to do today</h1>
<ol>
<li>Feed cat</li>
<li>Wash car</li>
<li>Grocery shopping</li>
</ol>
</body>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
The default type of ordered list uses Arabic
numbers, but you can use the type attribute
to change that. Example below identifies the
different types of ordered lists you can create
with the type attribute. To change the type of
ordered list, add the type attribute and its
value to the opening ol tag.
LOGO
rada_khim@yahoo.com
<ol start=”5” type=”I”>
<li>Wash car</li>
<li>Feed cat</li>
<li>Grocery shopping</li>
</ol>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
2- Bulleted lists
LOGO
rada_khim@yahoo.com
<body>
<h1>Things to do today</h1>
<ul>
<li>Feed cat</li>
<li>Wash car</li>
<li>Grocery shopping</li>
</ul>
</body>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
You can use the type attribute (deprecated)
with the <ul> element to specify what kind of
bullet you want the list to use.
disc: Solid circle bullets (the default)
square: Solid square bullets
circle: Hollow circle bullets
LOGO
rada_khim@yahoo.com
The addition of the type attribute to the
bulleted-list markup just given
changes bullets from discs to squares, as
shown in example below.
<ul type=”square”>
<li>Feed cat</li>
<li>Wash car</li>
<li>Grocery shopping</li>
</ul> LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
3- Definition Lists
Definition lists group terms and definitions
into a single list and require three different
elements to complete the list:
LOGO
Rada_khim@yahoo.com
The following definition list includes three
terms, one of which has two definitions:
LOGO
rada_khim@yahoo.com
<body>
<h1>Markup Language Definitions</h1>
<dl>
<dt>SGML</dt>
<dd>The Standard Generalized Markup Language</dd>
<dt>HTML</dt>
<dd>The Hypertext Markup Language</dd>
<dd>The markup language you use to create Web
pages.</dd>
<dt>XML</dt>
<dd>The Extensible Markup Language</dd>
</dl>
</body>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
4- Nesting Lists
LOGO
rada_khim@yahoo.com
The following example starts with a
numbered list that defines a list of things
to created for a term paper, and uses
three bulleted lists to break down those
items further.
LOGO
rada_khim@yahoo.com
<h1>Things to do today</h1>
<ol>
<li>Feed cat</li>
<ul>
<li>Rinse bowl</li>
<li>Open cat food</li>
</ul>
<li>Wash car</li>
<ul>
LOGO
rada_khim@yahoo.com
<li>Vacuum interior</li>
<li>Wash exterior</li>
</ul>
<li>Grocery shopping</li>
<ul>
<li>Plan meals</li>
<li>Clean out fridge</li>
</ul>
</ol>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Working With Links
LOGO
rada_khim@yahoo.com
Without links, a page stands alone, disconnected
from the rest of the Web. With links, that page
becomes part of an almost boundless collection of
information.
LOGO
rada_khim@yahoo.com
1- Add Links to Other Web Pages
LOGO
rada_khim@yahoo.com
The a tag itself doesn’t serve much purpose
without its attributes. The most common
attribute is href, which is short for hypertext
reference: it tells the browser where to find
the information to which you are linking.
LOGO
rada_khim@yahoo.com
The text included in between the opening
and closing a tags is what the person
viewing your web page can click. In most
cases, this text is highlighted as a different
color from the surrounding text and is
underlined
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
1.1-Absolute links
LOGO
rada_khim@yahoo.com
You must include the protocol (such as
http://) at the beginning of the link. For
example, if you are linking from your web site
to Yahoo!, you type http://www.yahoo.com
as your link.
LOGO
rada_khim@yahoo.com
1.2- Relative links
LOGO
rada_khim@yahoo.com
A more absolute way to say this might be “I
live at 2F Suntown Court in Anytown, Phnom
Penh .” The Relative links are most
commonly used when you want to link from
one page in your site to another.
LOGO
rada_khim@yahoo.com
The following is an example of what a relative link
might look like:
LOGO
rada_khim@yahoo.com
This link looks for the contactme.html file in
the same folder that contains this page. If you
were linking to a file in another folder below
the current one, the value of your href might
look like the following:
LOGO
rada_khim@yahoo.com
2- Add Links to Sections Within
the Same Web Page
LOGO
rada_khim@yahoo.com
2.1- Create an Anchor Name
<a name=”top”></a>
LOGO
rada_khim@yahoo.com
The anchor element that marks the spot
doesn’t affect the appearance of any
surrounding content. You can mark spots
wherever you need them without worrying
about how your pages look (or change) as a
result.
LOGO
rada_khim@yahoo.com
2.2- Link to an Anchor Name
LOGO
rada_khim@yahoo.com
<a href="#top">Return to the top of the page</a>
LOGO
rada_khim@yahoo.com
<body>
<h1><a name=”top”></a>Web-Based Training</h1>
<p>Given the importance of the Web to businesses and
other organizations, individuals who seek to improve
job skills, or fulfill essential job functions, are
turning to HTML and XML for training. We believe
this provides an outstanding opportunity for
participation in an active and lucrative adult and
continuing education market.</p>
<p><a href=”#top”>Back to top</a></p>
</body>
LOGO
rada_khim@yahoo.com
3- Add Links to E-Mail Addresses
and Downloadable Files
LOGO
rada_khim@yahoo.com
3.1- E-Mail Addresses
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
3.2- File downloads
LOGO
rada_khim@yahoo.com
if you want your users to download a PDF
file named doc.pdf and a .zip archive called
software.zip from a Web page, you use this
HTML:
<h1>Download the new version of our
software</h1>
<p><a href=”software.zip”>Software</a></p>
<p><a href=”doc.pdf”>Documentation</a></p>
LOGO
rada_khim@yahoo.com
You can make download markup more user-
friendly by adding supporting text and links,
like this:
LOGO
rada_khim@yahoo.com
<h1>Download our new software</h1>
<p> <a href=”software.zip”>Software</a> <br />
<b>Note:</b>
You need a zip utility such as
<a href=”http://www.winzip.com”>WinZip</a>
(Windows) or
<a href=”http://www.maczipit.com”>ZipIt</a>
(Macintosh) to open this file.</p>
LOGO
rada_khim@yahoo.com
<p><a href=”doc.pdf”>Documentation</a>
<br />
<b>Note:</b>You need the free
<a href=”http://www.adobe.com/products/
acrobat/readstep2.html”>Adobe Reader</a>
to view this file.</p>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Working with Images and
Multimedia
LOGO
rada_khim@yahoo.com
When you use the img tag, you’re telling the
browser to display the image right within the
web page, as shown in below.
Your image should be in a web-friendly file
format, such as GIF, JPEG, or PNG.
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
1- Image File Type
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
2- Adding an Image to a Web Page
LOGO
rada_khim@yahoo.com
The image (<img />) element is an empty
element (sometimes called a singleton tag)
that you place on the page where you want
your image to go. An empty element has
only one tag, with neither a distinct opening
nor closing tag.
LOGO
rada_khim@yahoo.com
The following markup places an image
named CD.jpg, which is saved in the same
directory as the (X)HTML file, between two
paragraphs:
LOGO
rada_khim@yahoo.com
<body>
<h1>CD as a Storage Medium</h1>
<p>CD-ROMs have become a standard storage option in
today’s computing world
because they are inexpensive and easy to use.</p>
<img src=”CD.jpg” />
<p>To read from a CD, you only need a standard CD-ROM
drive, but to create
CDs, you need either a CD-R or a CD-R/W drive.</p>
</body>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
3- Adding alternative text
LOGO
rada_khim@yahoo.com
Most of your users will see your images, but
be prepared for those who won’t. The HTML
specifications require that you provide
alternative text to describe each image on a
Web page. Use the alt attribute with the
<img /> element to add this information to
your markup, like this:
LOGO
rada_khim@yahoo.com
<body>
<p>Among the different sections of the orchestra
you will find:</p>
<p><img src=”07fg03-violin.jpg” alt=”violin “ />
Strings</p>
<p><img src=”07fg03-trumpet.jpg” alt=”trumpet” />
Brass</p>
<p><img src=”07fg03-woodwinds.jpg” alt=”clarinet
and saxophone” />
Woodwinds</p>
</body> LOGO
rada_khim@yahoo.com
When browsers don’t display an image (or
can’t, as in text-only browsers such as Lynx),
they display the alternative text instead, as
shown in next slide.
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
When browsers show an image, some
browsers — including Internet Explorer,
Netscape, and Opera — show alternative
text as pop-up tooltips when you hover your
mouse pointer over an image for a few
seconds, as shown in the next slide.
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
This means you can use alternative text
either to describe the image to those who
can’t see it or to provide useful information
about the image.
LOGO
rada_khim@yahoo.com
4- Specifying image size
LOGO
rada_khim@yahoo.com
You can use the height and width attributes with
the <img /> element to let the browser know just
how tall and wide an image is (in pixels):
LOGO
rada_khim@yahoo.com
<p><img src=” trumpet.jpg” width=”200”
height=”64” alt=”trumpet” />
Brass</p>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
If you don’t know the size of your image, you
can open it in a graphics editor, such as
Adobe Photoshop or Fireworks, to find out.
Or you can use the browser to determine the
size of your images.
LOGO
rada_khim@yahoo.com
5- Setting an image border
LOGO
rada_khim@yahoo.com
This markup sets the border for the clarinet
image to 10 pixels:
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
6- Controlling image alignment
LOGO
rada_khim@yahoo.com
middle: Aligns the text around the image
with the middle of the image.
bottom: Aligns the text around the image
with the bottom of the image.
left: The image sits on the left, and text
floats to the right of the image.
right: The image sits on the right, and text
floats to the left of the image.
LOGO
rada_khim@yahoo.com
By default, most browsers align images to
the left and float all text to the right. The
following markup shows how two different
<img /> elements use the align attribute to
change how text floats around an image —
in this case, the Pimouse.jpg image:
LOGO
rada_khim@yahoo.com
<p> <img src=”Pimouse.jpg” alt=”mouse with top-
aligned text” height=”63” width=”100”
align=”top” />
This text is aligned with the top of the image.
</p>
<p> <img src=”Pimouse.jpg” alt=”mouse with middle-
aligned text” height=”63” width=”100”
align=”middle” />
This text is aligned with the middle of the image.
</p>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
7- Setting image spacing
LOGO
rada_khim@yahoo.com
<p>
This text doesn’t crowd the image on top.
<br /> <img src=”Pimouse.jpg” height=”63”
width=”100” hspace=”20” vspace=”25”
alt=”mouse on a white background” />And
this text is a little further away from the sides.
</p>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
8- Use Images as the Background
of a Web Page
LOGO
rada_khim@yahoo.com
The old HTML specifications enabled you
to add a single image to be used as the
“scenery” in the background of your web
page. This was accomplished using the
background attribute of the body tag, as in
<body background="picture.jpg">.
LOGO
rada_khim@yahoo.com
However, the W3C retired the background
attribute, in favor of using style sheets to
specify backgrounds. The latter is done by
adding the background-image property to a
style declaration for the body tag:
body {background-image: url("picture.jpg");}
LOGO
rada_khim@yahoo.com
to force the background image to remain
stationary is to add the background-
attachment property to the page’s style
sheet. This property allows the background
to stay in place (when set to “fixed”) or to
move when the page is scrolled (when set
to “scroll”).
LOGO
rada_khim@yahoo.com
Similarly, you can even tell the browser
whether or not to repeat your background
image at all, using the background-repeat
property.
LOGO
rada_khim@yahoo.com
body {background-image: url("picture.gif");
background-attachment: fixed;
background-repeat: no-repeat;}
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Building image maps
LOGO
rada_khim@yahoo.com
To create an imagemap, you place an image
using the <img/> tag as usual, and then use
the usemap attribute to specify which
imagemap to use. You then use <map> and
</map> tags to define a map that consists of
different areas, each of which is linked to a
different page or to a different anchor on the
same page.
LOGO
rada_khim@yahoo.com
The areas are defined by their coordinates
from the upper-left corner of the image,
which has coordinate 0,0. Each area can be
a rectangle (rect), a circle (circle), or a free-
form polygon (poly).
LOGO
rada_khim@yahoo.com
To create the imagemap:
1- Open the graphic in your graphics
program, and use the program’s selection
tools to work out the coordinates of the areas
you will need to define within the image. For
example, the coordinates "0,0,320,240"
define the upper-left quarter of the sample
graphic.
LOGO
rada_khim@yahoo.com
2-Type the <img/> tag with the src attribute
specifying the graphic file, the alt attribute
specifying the alternative text, and the
usemap attribute specifying the name of the
map you’ll create—for example: <img
src="map1.jpg“ alt=“picture showing Acme
Virtual Industries’ main service areas”
usemap="#map1_map">
LOGO
rada_khim@yahoo.com
3- Type the opening <map> tag, and set the name
attribute to the name you used for the usemap
attribute of the <img/> tag—for example:
<map name="map1_map">
LOGO
rada_khim@yahoo.com
4- Type an <area> tag with the href attribute
specifying the destination page for the
hyperlink, the alt attribute specifying the
alternative text for the hyperlink (if desired),
the shape attribute specifying the type of
area (rect, circle, or poly), and the coords
attribute specifying the coordinates of the
area.
LOGO
rada_khim@yahoo.com
For example,
this code defines a rectangular area 320 pixels
wide by 240 pixels high, starting at the upper-left
corner of the graphic:
LOGO
rada_khim@yahoo.com
Enter <area> tags for the other areas in the
graphic— for example:
LOGO
rada_khim@yahoo.com
<area href="security.html“ alt="Security Services"
shape="rect“ coords="320,0,640,240">
<area href="computing.html“ alt="Computing
Services“ shape="rect“ coords="320,240,640,480">
Type the closing </map> tag:
</map>
LOGO
rada_khim@yahoo.com
Multimedia
LOGO
rada_khim@yahoo.com
You can create links that allow users to
download audio or video files, play audio or
video files in a separate player, or play audio
or video files within your web page.
LOGO
rada_khim@yahoo.com
1- Audio and Video Formats
LOGO
rada_khim@yahoo.com
Use compressed audio formats for all but the
shortest audio files. Most computers can play
MP3 files (which are compressed) and WAV
files (which are not compressed). Also,
consider reducing the complexity of the
audio file—for example, by reducing it from a
16-bit sound to an 8-bit sound, or by using
mono instead of stereo.
LOGO
rada_khim@yahoo.com
The file will not sound as good, but visitors to your
website will be able to get it that much more
quickly.
LOGO
rada_khim@yahoo.com
2- Audio and Video Delivery
Methods
LOGO
rada_khim@yahoo.com
People who download the files can listen to
the audio or watch the video as many
times as they like.
LOGO
rada_khim@yahoo.com
Downloads work even over a slow or
patchy connection (for example, a modem
connection or a congested broadband
connection), provided the downloader has
enough time and patience to download the
whole file.
LOGO
rada_khim@yahoo.com
3- Create a Link for Downloading
an Audio or Video File
LOGO
rada_khim@yahoo.com
This example tells visitors how to download
an MP3 file:
LOGO
rada_khim@yahoo.com
4- Create a Link to Play an Audio
or Video File
LOGO
rada_khim@yahoo.com
<p>Click
<a href="media/virtual_office_tour.avi">here</a>
to watch our Virtual Office Tour video (AVI format,
12.4MB).
</p>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
5- Using the object Tag
LOGO
rada_khim@yahoo.com
<object type="application/x-shockwave-flash"
data="movie.swf“ height="60" height="200">
LOGO
rada_khim@yahoo.com
Then, after the opening object tag, you add
any additional properties you want to specify
using the param tag (short for parameters).
(Note that the object tag enables you to
specify the height and width attributes either
in the object tag or in param tags, depending
on the plug-in employed.)
LOGO
rada_khim@yahoo.com
<param name="movie" value="movie.swf" />
<param name="BGCOLOR" value="#ffffff" />
</object>
LOGO
rada_khim@yahoo.com
6- Using The <embed> Element
LOGO
rada_khim@yahoo.com
<embed height="100" width="100" src=“Song.mp3">
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Working With Form
LOGO
rada_khim@yahoo.com
The visitor can interact with the fields—for
example, by typing text into a text field, by
selecting a check box or one option button in
a group of option buttons, or by choosing an
item from a drop-down list.
LOGO
rada_khim@yahoo.com
When finished with the form, the visitor clicks
a command button that submits the form,
usually by running a Common Gateway
Interface, or CGI, script written in a
programming language such as JavaScript .
LOGO
Rada_khim@yahoo.com
1- The Form Tag
The <form> tag is used to create an HTML
form:
<form>
.
input elements
.
< /form>
LOGO
rada_khim@yahoo.com
2- The Input Elements
LOGO
rada_khim@yahoo.com
The values of Attribute Type are:
Text
Password
Checkbox
Radio
Submit
LOGO
rada_khim@yahoo.com
Hidden
Image
Button
Reset
File
LOGO
rada_khim@yahoo.com
3- Add a Single-Line Textbox
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
4- Add a Multi-Line Textbox
LOGO
rada_khim@yahoo.com
<textarea cols="40" rows="10">Please type
your message here.</ textarea>
LOGO
rada_khim@yahoo.com
5- Add a Drop-Down list
LOGO
rada_khim@yahoo.com
<select size=1>
<option value="1">AL</option>
<option value="2">AK</option>
<option value="3">AR</option>
<option value="4">AS</option>
<option value="5">AZ</option>
<option value="6">CA</option>
<option value="7">CO</option>
<option value="8">CT</option>
...
<option value="58">WI</option>
<option value="59">WY</option>
</select>
LOGO
rada_khim@yahoo.com
6- Add a Checkbox
For presenting options that are not mutually
exclusive, use check boxes. To add
a check box:
<form>
< input type="checkbox" name=“UseCheck"
value=“Check">Choose 1>
< input type="checkbox" name=“UseCheck"
value=“Check1">Choose 2
< /form>
LOGO
rada_khim@yahoo.com
7- Add Option Buttons
LOGO
rada_khim@yahoo.com
<form>
< /form>
LOGO
rada_khim@yahoo.com
8- Complete a Form
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Creating Tables
LOGO
rada_khim@yahoo.com
A table element consists of three different
HTML tags including the <table> tag, <tr>
(table rows), and the <td> (table columns)
tags. For example:
LOGO
rada_khim@yahoo.com
1- The <table> tag
The table tag is a container for every other
tag used to create a table in HTML. The
opening and closing table tags should be
placed at the beginning and end of your
table.
<Table>
…………
</table>
LOGO
rada_khim@yahoo.com
1.1- The <tr> Tag
The tr tag stands for table row. The opening
and closing tr tags surround the cells for that
row.
<table>
<tr>
………………..
</tr>
</table>
LOGO
rada_khim@yahoo.com
<table>
<tr>
<dt>1 Row Create</td>
</tr>
<tr>
<td>2 Row Create</td>
</tr>
</table>
LOGO
rada_khim@yahoo.com
1.2-The <th> Tag
LOGO
rada_khim@yahoo.com
<table >
<tr>
<th>Title1</th>
<th>Titile2</th>
</tr>
</table>
LOGO
rada_khim@yahoo.com
1.3- The <td> Tag
LOGO
rada_khim@yahoo.com
1.4- The <td> align Attribute
LOGO
rada_khim@yahoo.com
1.5- The <td> bgcolor Attribute
Syntax:
<td bgcolor="color_name|hex_number|rgb_number">
LOGO
rada_khim@yahoo.com
1.6 The <td> colspan Attribute
LOGO
rada_khim@yahoo.com
1.7- The <td> rowspan Attribute
Syntax:
<td rowspan="number">
LOGO
rada_khim@yahoo.com
1.8- The <td> width Attribute
LOGO
rada_khim@yahoo.com
1.9- The <td> height Attribute
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Create a Vertical Line
LOGO
rada_khim@yahoo.com
<table frame="void" rules="cols"
cellspacing="2" cellpadding="5">
<tr>
<th valign="top" align="left">
Lesson I</th>
<th valign="top" align="left">
Lesson II</th>
</tr>
LOGO
rada_khim@yahoo.com
<tr>
<td><i>Thank for your attention to< /i></td>
<td>yes,sir !</td>
</tr>
<tr>
<td><i> Please try yourselt at home for more
!</i></td>
<td>Thank for your advice!</td>
</tr>
LOGO
rada_khim@yahoo.com
<tr>
<td><i>This is the more Lesson</i></td>
<td>Thank you so much</td>
</tr>
</table>
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
Create a Nested Table
LOGO
rada_khim@yahoo.com
To nest a table, enter the complete structure
of the nested table within the <td> and </td>
tags for the cell in which you want the nested
table to appear. See the picture for example:
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
<table border="1">
<tr>
<td>Column 1</td>
<td>Column 2</td>
<td>Column 3</td>
</tr>
LOGO
rada_khim@yahoo.com
<tr>
<td>Column 1</td>
<td>
<table border="1">
<tr>
<td>Table</td>
<td>nested</td>
</tr>
LOGO
rada_khim@yahoo.com
<tr>
<td>in a</td>
<td>cell</td>
</tr>
</table>
</td>
<td>Column 3</td>
</tr>
</table> LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Using Marquee
LOGO
rada_khim@yahoo.com
For example:
<body>
<marquee>
This is my text, it is running !
</marquee>
</body>
LOGO
rada_khim@yahoo.com
1- Marquee’s Attributes
BGCOLOR="color" → to manage
background color of an object .
<marquee BGCOLOR=“Red”>
This is my text, it is running !
</marquee>
LOGO
rada_khim@yahoo.com
DIRECTION="left/right/up/down“→ to
manage direction of the moving object.
<marquee BGCOLOR=“Red”
DIRECTION=“Right”>
This is my text, it is running !
</marquee>
LOGO
rada_khim@yahoo.com
TITLE=“message“→ The title or message
will emerge when the computer mouse at
the marquee object.
SCROLLMOUNT="number" → to manage
the speed of marquee, ever greater of
number is faster his speed.
LOGO
rada_khim@yahoo.com
BEHAVIOR="scroll/slide/alternate“→ to
manage behavior of the moving object .
Note:
- Scroll → object moving scroll.
- Slide → object moving 1 time and then
stop.
- Alternate → object moving from left to
right and then right to left .
LOGO
rada_khim@yahoo.com
SCROLLDELAY="number" → to manage
delay time, it's on second.
LOGO
rada_khim@yahoo.com
LOOP="number" → to manage sum of looping.
LOGO
rada_khim@yahoo.com
For example using attributes of marquee:
LOGO
rada_khim@yahoo.com
2- Using Hover Over the Marquee
LOGO
rada_khim@yahoo.com
<marquee behavior="scroll" direction="left"
scrollamount="12"
onmouseover="this.setAttribute('scrollamoun
t', 3, 0);"
onmouseout="this.setAttribute('scrollamount',
12, 0);">
Testing hover over me!
</marquee>
LOGO
rada_khim@yahoo.com
3- Using Start() and Stop()
LOGO
rada_khim@yahoo.com
<marquee behavior="scroll" direction="left"
scrollamount="20"
onmouseover="this.stop();"
onmouseout="this.start();">
Go on... hover over me!
</marquee>
LOGO
rada_khim@yahoo.com
<html><body>
<marquee behavior="scroll" direction="left" id="myrun">
<p>press the button!</p></marquee>
<input type="button" value="Stop Marquee"
onClick="document.getElementById('myrun').stop();">
<input type="button" value="Start Marquee"
onClick="document.getElementById('myrun').start();">
</body></html>
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Working With CSS
LOGO
rada_khim@yahoo.com
CSS helps Web developers create a uniform
look across several pages of a Web site.
Instead of defining the style of each table
and each block of text within a page's HTML,
commonly used styles need to be defined
only once in a CSS document.
LOGO
rada_khim@yahoo.com
1- How CSS Works
LOGO
rada_khim@yahoo.com
CSS works with HTML, but it’s not HTML. It’s
a different language altogether. While HTML
provides structure to a document by
organizing information into headers,
paragraphs, bulleted lists, and so on, CSS
works hand-in-hand with the web browser to
make HTML look good.
LOGO
rada_khim@yahoo.com
2- CSS Syntax
A style sheet is a collection of style
definitions. Every CSS style definition, or
rule, has two main components:
A list of one or more selectors
The declaration block
LOGO
rada_khim@yahoo.com
3- How to Define CSS to HTML
LOGO
rada_khim@yahoo.com
Let’s look at a basic example to see how this
is done. Consider the following HTML
document outline:
LOGO
rada_khim@yahoo.com
<body>
<h1>First Title</h1>
<p>A paragraph of interesting content.</p>
<h2>Second Title</h2>
<p>A paragraph of interesting content.</p>
<h2>Third title</h2>
<p>A paragraph of interesting content.</p>
</body>
LOGO
rada_khim@yahoo.com
This document contains three headings,
which have been created using <h1>and
<h2> tags. Without CSS styling, the headings
will be rendered using the browser’s internal
style sheet—the h1 heading will be displayed
in a large font size, and the h2 headings will
be smaller than the h1, but larger than
paragraph text.
LOGO
rada_khim@yahoo.com
can use some simple CSS to change the look
of these elements:
<head>
<style type="text/css">
h1, h2 { font-family: sans-serif;
color: yellow; }
</style>
</head>
LOGO
rada_khim@yahoo.com
<body>
<h1>First Title</h1>
<p>A paragraph of interesting content.</p>
<h2>Second Title</h2>
<p>A paragraph of interesting content.</p>
<h2>Third title</h2>
<p>A paragraph of interesting content.</p>
</body>
LOGO
rada_khim@yahoo.com
See more example:
<head>
<style type="text/css">
Body
{ background-color:Green; }
h1 { color:orange;text-align:center;}
p { font-family:"Times New Roman";font-size:20px;}
</style>
</head>
LOGO
rada_khim@yahoo.com
<body>
<h1>CSS Heading 1 example!</h1>
<p>This is a paragraph that using CSS.</p>
</body>
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Understanding Style Sheets
LOGO
rada_khim@yahoo.com
A style sheet can be one of two types—
internal or external, depending on whether
the style information is located in the web
page itself or in a separate file linked to the
web page.
LOGO
rada_khim@yahoo.com
1- Inline Style
LOGO
rada_khim@yahoo.com
<p style="font-family: sans-serif; color:
#3366CC;"> Test to using inline. </p>
<h1 style="color: #C7AA8D; font-size: 14;">
LOGO
rada_khim@yahoo.com
2- internal style sheet
LOGO
rada_khim@yahoo.com
<head>
<style type="text/css">
h1 {
color: #FF7643;
font-family: Arial;
}
p{
color: red;
font-size: 1.5em;
}
</style>
</head> LOGO
rada_khim@yahoo.com
Internal style sheets are easy to add to a
web page and provide an immediate to
your HTML. But they aren’t the most efficient
method for designing an entire website
composed of many web pages.
LOGO
rada_khim@yahoo.com
For one thing, you need to copy and paste
the internal style sheet into each page of
your site—a time-consuming chore that adds
bandwidth-hogging code to each page.
LOGO
rada_khim@yahoo.com
But internal style sheets are even more of a
hassle when you want to update the look of a
site. For example, say you want to change
the <h1> tag, which you originally decided
should appear as large, green, bold type. But
now you want small, blue type in the Courier
typeface.
LOGO
rada_khim@yahoo.com
Using internal style sheets, you’d need to
edit every page. Who has that kind of time?
Fortunately, there’s a simple solution to
this dilemma—external style sheets.
LOGO
rada_khim@yahoo.com
3- External Style Sheets
LOGO
rada_khim@yahoo.com
3.1- Link a Style Sheets
LOGO
rada_khim@yahoo.com
<head> <title>A Simple Page</title>
<link rel="stylesheet" type="text/css"
href="styles.css" />
</head>
LOGO
rada_khim@yahoo.com
<body>
<h1>First Title</h1>
<p>…</p>
<h2>Second Title</h2>
<p>…</p>
<h2>Third Title</h2>
<p>…</p>
</body>
LOGO
rada_khim@yahoo.com
rel="stylesheet" indicates the type of
link—in this case, a link to a style sheet.
type="text/css" lets the browser know
what kind of data to expect—a text file,
containing CSS.
LOGO
rada_khim@yahoo.com
href points to the location of the external
CSS file on the site. The value of this
property is a URL and will vary depending
on where you keep your CSS file. It works
the same as the src attribute you use when
adding an image to a page or the href
attribute of a link pointing to another page.
LOGO
rada_khim@yahoo.com
3.2- Link a Style Sheets Using
CSS
CSS includes a built-in way to add external
style sheets—the @import directive.
You add the directive inside of an HTML
<style> tag, like so:
<style type="text/css">
@import url(css/global.css);
</style> LOGO
rada_khim@yahoo.com
Unlike HTML’s <link> tag, @import is part of
the CSS language and has some definite un-
HTML -like qualities:
LOGO
rada_khim@yahoo.com
To make the connection to the external
CSS file, you use url instead of href and
enclose the path in parentheses. So in this
example, css/global.css is the path to the
external CSS file. Quotes around the URL
are optional, so url(css/global.css)
and url("css/global.css") both work.
LOGO
rada_khim@yahoo.com
As with the <link> tag, you can include
multiple external style sheets using
more than one @import:
<style type="text/css">
@import url(css/global.css);
@import url(css/forms.css);
</style>
LOGO
rada_khim@yahoo.com
You can add regular CSS styles after the
@import directives if you want to create a
rule that applies just to that one page, but
still use the site’s global design rules
to format the rest of the page.
For example:
LOGO
rada_khim@yahoo.com
<style type="text/css">
@import url(css/global.css);
@import url(css/forms.css);
p { color:red; }
</style>
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Selectors
LOGO
rada_khim@yahoo.com
or based on the current status in the
document. You can also combine simple
selectors to form a chain of conditions that
must be met before the style rule is applied.
LOGO
rada_khim@yahoo.com
1- Universal selector
LOGO
rada_khim@yahoo.com
For example, say you want all the tags on
your page to appear in bold type. Your
group selector might look something like the
following:
LOGO
rada_khim@yahoo.com
The asterisk, however, is a much shorter
way to tell CSS to select all HTML tags on
the page:
* { font-weight: bold; }
LOGO
rada_khim@yahoo.com
2- Type Selector
LOGO
rada_khim@yahoo.com
For example, the following style rule might
be used to set the default paragraph font for
a web site:
p{
font-family: Tahoma, Verdana, Arial,
Helvetica, sans-serif ; font-size: 1em;
color: #000000;
}
LOGO
rada_khim@yahoo.com
3- ID Selector
An ID selector matches an element that
has a specific id attribute value. Since
id attributes must have unique values,
an ID selector can never match more
than one element in a document.
LOGO
rada_khim@yahoo.com
#banner {
background: #CC0000;
height: 300px;
width: 720px;
}
LOGO
rada_khim@yahoo.com
4- Class Selector
LOGO
rada_khim@yahoo.com
.special {
color:#FF0000;
font-family:"Monotype Corsiva";
}
LOGO
rada_khim@yahoo.com
5- Grouping Selector
LOGO
rada_khim@yahoo.com
This example consists of only tag selectors,
but you can use any valid selector (or
combination of selector types) in a group
selector. For example, here’s a selector that
applies the same font color to the <h1> tag,
the <p> tag, any tag styled with the .copyright
class, and the tag with the #banner ID.
h1, p, .copyright, #banner { color: red; }
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
6- Descendant Selector
LOGO
rada_khim@yahoo.com
both heading tags and the <strong> tag in
bold, so anyone viewing the page can’t
see any difference between the emphasized
word and the other words in the headline.
A descendent selector lets you do what you
really want—change the color of the <strong>
tag only when it appears inside of an <h1>
tag.
LOGO
rada_khim@yahoo.com
The solution to the <h1> and <strong>
dilemma looks like this:
LOGO
rada_khim@yahoo.com
7- Child Selector
LOGO
rada_khim@yahoo.com
For example, the selector body > h1 selects
any <h1> tag that’s a child of the <body>
tag.
Unlike a descendent selector, which applies
to all descendents of a tag (children,
grandchildren, and so on), the child selector
lets you specify which child of which
parent you mean.
LOGO
rada_khim@yahoo.com
See more example:
p{
color: #0000FF;
}
.sidebar>p {
color: #FFFFFF; }
LOGO
rada_khim@yahoo.com
8- Adjacent Sibling Selector
An adjacent selector will only match an
element if it’s adjacent to another specified
element. Therefore, if we have HTML:
<h2>This is a title</h2>
<p>This paragraph will be displayed in white.</p>
<p>This paragraph will be displayed in black.</p>
LOGO
rada_khim@yahoo.com
And then use the following selector:
p{
color: #000000; }
h2+p {
color: #FFFFFF; }
LOGO
rada_khim@yahoo.com
Only the first paragraph will be displayed in
white. The second p element is not adjacent
to an h2 and therefore its text would be
displayed in the black we have specified for
p elements in the first rule.
LOGO
rada_khim@yahoo.com
9- Attribute Selector
LOGO
rada_khim@yahoo.com
Fortunately, you realize that you’ve given all
the photos descriptions using the title
attribute, which means you can use an
attribute selector to identify just the important
images.
LOGO
rada_khim@yahoo.com
With attribute selectors, you can single out
tags that have a particular property. For
example, here’s how to select all <img> tags
with a title attribute:
img[title]
The first part of the selector is the name of
the tag (img) while the attribute’s name
goes in brackets: [title].
LOGO
rada_khim@yahoo.com
To get more specific, you can select
elements that not only share a particular
attribute but also have an exact value set for
that attribute. For example, when you want to
highlight links that point to a particular URL,
create an eye-catching attribute selector, like
so:
a[href="http://www.cosmofarmer.com"]{ color:red; font-
weight:bold; }
LOGO
rada_khim@yahoo.com
Similarly, there are times when you want to
select an element with an attribute that
ends in a specific value. Again, links are
handy for this task. Say you want to add a
little document icon next to any links that
point to a PDF file. Since PDF documents
end in .pdf,
LOGO
rada_khim@yahoo.com
you know a link pointing to one of those files
will end in .pdf—for example,
<a href="download_instructions.pdf">.
So to select just those types of links, you’d
create a selector like this:
a[href$=".pdf"]
LOGO
rada_khim@yahoo.com
The full style might look something like this:
a[href$=".pdf"] {
background-image: url(icon.png) no-repeat;
padding-left: 15px;
};
LOGO
rada_khim@yahoo.com
Thanks
LOGO
rada_khim@yahoo.com
Page Layouts
LOGO
rada_khim@yahoo.com
This chapter introduces the common
techniques and building blocks used for
laying out HTML content in your pages.
LOGO
rada_khim@yahoo.com
1- Two Columns
LOGO
rada_khim@yahoo.com
The layout consists of a header, a horizontal
navigation bar, a main content column, a
sidebar, and a footer. It is also horizontally
centered in the browser window. A pretty
basic layout, and not at all difficult to create
with CSS once you know how to deal with
the inevitable Internet Explorer bugs.
LOGO
rada_khim@yahoo.com
Step 1: First of all, we create the basic HTML
structure:
<div id="wrap">
<div id="header"></div>
<div id="nav"></div>
<div id="main"></div>
<div id="sidebar"></div>
<div id="footer"></div>
</div>
LOGO
rada_khim@yahoo.com
After that, we put some content in the different
sections:
<div id="wrap">
<div id="header"><h1>Document Heading</h1></div>
<div id="nav">
<ul>
<li><a href="#">Option 1</a></li>
<li><a href="#">Option 2</a></li>
...
</ul>
</div>
LOGO
rada_khim@yahoo.com
<div id="main">
<h2>Column 1</h2>
<p>Lorem ipsum dolor sit amet,
consectetuer adipiscing elit...</p>
</div>
LOGO
rada_khim@yahoo.com
<div id="sidebar">
<h2>Column 2</h2>
<p>Lorem ipsum dolor sit amet, consectetuer
adipiscing elit...</p>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
...
</ul>
</div>
LOGO
rada_khim@yahoo.com
<div id="footer">
<p>Footer</p>
</div>
</div>
LOGO
rada_khim@yahoo.com
Step 2: Now we have a completely unstyled
HTML document which is structured in a way
that lets us use CSS to control its layout. After
that adjust the body and html elements. we
set the margin and padding of the body and
html elements to zero. We also specify colors
for text and background.
LOGO
rada_khim@yahoo.com
body,
html {
margin:0;
padding:0;
color:#000;
background:#a7a09a;
}
LOGO
rada_khim@yahoo.com
Step 3:On to the main containers
After that it’s time to give the content area a
width and center it horizontally. We do that
by specifying the width and margins of the
main container, #wrap. We also give it a
background color to make it show up on the
page.
LOGO
rada_khim@yahoo.com
The method we use to center the content is
based on the fact that when an element’s left
and right margins are set to auto, they will
share whatever is left when the element’s
width has been subtracted from that of its
container. In this case the width of #wrap will
be subtracted from the width of the browser
window.
LOGO
rada_khim@yahoo.com
Note: for this method to work in Internet Explorer
(version 6 and later only), the document must use
a DOCTYPE that forces IE to use its standards
mode.
LOGO
rada_khim@yahoo.com
#wrap {
width:750px;
margin:0 auto;
background:#99c;
}
LOGO
rada_khim@yahoo.com
In case you’re wondering why we’re not using
the body element to control the width and
centering of the layout, it is because doing so
can cause unwanted side-effects in some
versions of Internet Explorer
LOGO
rada_khim@yahoo.com
After that, we give the different sections of
the document different background colors to
make them show up.
LOGO
rada_khim@yahoo.com
#header {
background:#ddd;
}
#nav {
background:#c99;
}
LOGO
rada_khim@yahoo.com
#main {
background:#9c9;
}
#sidebar {
background:#c9c;
}
#footer {
background:#cc9;
}
LOGO
rada_khim@yahoo.com
Step4: Place the columns side by side
To make the two columns (#main and
#sidebar) display side by side we float them,
one to the left and the other to the right. We
also specify the widths of the columns.
LOGO
rada_khim@yahoo.com
#main {
float:left;
width:500px;
background:#9c9;
}
LOGO
rada_khim@yahoo.com
#sidebar {
float:right;
width:250px;
background:#c9c;
}
LOGO
rada_khim@yahoo.com
Note that the sum of the widths should be
equal to the width given to #wrap in Step 3.
This will make #sidebar appear to the right of
#main, but the footer is not where it should
be.
LOGO
rada_khim@yahoo.com
Step 5: Push the footer down
The footer doesn’t get pushed down to the
bottom of the content because of the way
float works. When you float an element, it is
removed from the document flow and doesn’t
push elements that follow it down. In this
case #footer will start right below #sidebar.
LOGO
rada_khim@yahoo.com
To avoid this we use the clear property to tell
the footer that it can’t have any elements
next to it.
#footer {
clear:both;
background:#cc9;
}
LOGO
rada_khim@yahoo.com
Step6: Fix the background color
Now we can see that the shorter column
doesn’t continue all the way down to the
footer. To make it look like it does, we use
the same background color for #sidebar and
#wrap.
LOGO
rada_khim@yahoo.com
Also, if you take a look at this step in Internet
Explorer 6 you may notice that the
background color of the footer is pushing up
beside the main content. That will be taken
care of later.
LOGO
rada_khim@yahoo.com
Step7:Make the navigation bar horizontal
LOGO
rada_khim@yahoo.com
#nav ul {
margin:0;
padding:0;
list-style:none;
}
#nav li {
display:inline;
margin:0;
padding:0;
} LOGO
rada_khim@yahoo.com
Step8. Adjust margins and paddings
LOGO
rada_khim@yahoo.com
#header {
padding:5px 10px;
background:#ddd;
}
h1 {
margin:0;
}
LOGO
rada_khim@yahoo.com
#nav {
padding:5px 10px;
background:#c99;
}
#main {
float:left;
width:480px;
padding:10px;
background:#9c9;
} LOGO
rada_khim@yahoo.com
h2 {
margin:0 0 1em;
}
#sidebar {
float:right;
width:230px;
padding:10px;
background:#99c;
}
LOGO
rada_khim@yahoo.com
#footer {
clear:both;
padding:5px 10px;
background:#cc9;
}
#footer p {
margin:0;
}
LOGO
rada_khim@yahoo.com
One thing to take note of here is that when
we added padding to #main and #sidebar,
we subtracted the width of the left and right
paddings from each element’s width.
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
2- Three Columns
The HTML structure
<div id="body">
<div id="header"></div>
<div id="main">
<div id="content-1"></div>
<div id="content-2">
<div id="content-2-1"></div>
<div id="content-2-2"></div>
</div> </div>
<div id="footer"></div>
</div>
LOGO
rada_khim@yahoo.com
Here’s what those elements are used for:
#body
#header
#main
#content-1
#content-2
#content-2-1
#content-2-2
#footer
LOGO
rada_khim@yahoo.com
Step 1: The unstyled HTML
Step 2: Overall width and some colors
LOGO
rada_khim@yahoo.com
#body { width:960px; margin:0 auto;
background:#ddd; }
#header { background:#fdd; }
#content-1 { background:#bfb; }
#content-2-1 { background:#ddf; }
LOGO
rada_khim@yahoo.com
#content-2-2 { background:#dff; }
#footer { background:#ff9; }
Step 3: Create the first two columns
LOGO
rada_khim@yahoo.com
Step 4: Create the nested columns
LOGO
rada_khim@yahoo.com
Step 5: Push the footer down
LOGO
rada_khim@yahoo.com
#header { padding:10px; background:#fdd; }
#content-1 { float:left; width:220px;
padding:10px; background:#bfb; }
#content-2-1 { float:left; width:460px;
padding:10px; background:#ddf; }
#content-2-2 { float:right; width:220px;
padding:10px; background:#dff; }
LOGO
rada_khim@yahoo.com
#footer { clear:both; padding:10px;
background:#ff9; }
LOGO
rada_khim@yahoo.com
LOGO
rada_khim@yahoo.com
LOGO