Pages

Thursday, July 8, 2010

:: HTML Elements Part 10 ::

HTML Lists

HTML Lists offers authors several mechanisms for specifying lists of information. All lists must contain one or more list elements.

For example

<html>
<head>
<title> The tenth lesson </title>
</head>
<body>
<br>Unordered List
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
<br>Ordered List
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
<br>Definition List
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
</body>
</html>

Lists may contain:
  • Unordered information.
  • Ordered information.
  • Definition information
HTML Unordered Lists

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.The list items are marked with bullets (typically small black circles).

<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>

HTML Ordered Lists

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.The list items are marked with numbers.

<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>

HTML Definition Lists

A definition list is a list of items, with a description of each item.The <dl> tag defines a definition list.The <dl> tag is used in conjunction with <dt> (defines the item in the list) and <dd> (describes the item in the list):

<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>

Conclusion


HTML List Tags

Tag Description
<ol> Defines an ordered list
<ul> Defines an unordered list
<li> Defines a list item
<dl> Defines a definition list
<dt> Defines an item in a definition list
<dd> Defines a description of an item in a definition list


Wednesday, July 7, 2010

:: HTML Elements Part 9 ::

HTML Forms

HTML Forms are used to pass data to a server. The most important form element is the the input element. The input element is used to select user information. An input element can be vary in many ways depending on the type attribute. An input element can be of type text field, checkbox , password, radio button, submit button and more. A form can also contain select lists , textarea, fieldset, legend and label elements.There are many attributes of form syntax such as name, method, action .

For example


<html>
<head>
<title> The nineth lesson </title>
</head>
<body>
<form name=”student” action=”student.php” method=”post” >
Input elements
</form&gt;
</body>
</html>

Input elements

Input elements are very important to select user information. Normally, these input elements will be send to server side. The server will take action whether to save the information or display information of users.There are many input elements can be added in HTML Forms. Several of them are textfield, checkbox, password, radio button, submit button and more.

Textfield

Textfield allow user to enter text into one-line input field.

<form>
First name : <input type =”text” name=”firstname”/>
</form>

Checkbox

Checkbox element allow user to select ONE or MORE options of a limited number of choices.

<form>
<input type ="checkbox" name="vehicle" value="Mawar" /> Mawar <br/>
<input type ="checkbox" name="vehicle" value="Teratai" /> Teratai <br/>
</form>

Password field

Password field almost same to the textfield. But when user enter text into one-line input filed, it will display in asterisk character.

<form>
Password : <input type =”passwordt” name=”pass”/>
</form>

Radio button

Radio button allow user to select ONLY ONE option of a limited number of choices.

<form>
<input type ="radio" name="sex" value="male" /> Male <br/>
<input type ="radio" name="sex" value="female" /> Female <br/>
</form>

Submit button

Submit button allow user to pass user information to server side.

<form>
<form name=”student” action=”student.php” method=”post” >
Username : < input type="text" name="user" />
<input type="submit" value="Submit" />
</form>

Drop down list

Drop down list allow user to choose one of many options.

Below is the simple example drop down list.

<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</form>

Below is the simple example drop down list with a pre-selected value.

<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected="selected">Fiat</option>
<option value="audi">Audi</option>
</select>
</form>

Textarea

Textarea allows user to write unlimited number of characters. This textarea will be add in HTML Forms.

<textarea rows="10" cols="30"> The cat was playing in the garden. </textarea>

Conclusion.

HTML Form Tags

Tag Description

<form>

Defines an HTML form for user input

<input />

Defines an input control

<textarea>

Defines a multi-line text input control

<label>

Defines a label for an input element

<fieldset>

Defines a border around elements in a form

<legend>

Defines a caption for a fieldset element

<select>

Defines a select list (drop-down list)

<optgroup>

Defines a group of related options in a select list

<option>

Defines an option in a select list

<button>

Defines a push button


:: HTML Elements Part 8 ::

HTML Tables

HTML Tables uses <table> tag.A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). td stands for "table data," and holds the content of a data cell. A <td&gt; tag can contain text, links, images, lists, forms, other tables, etc. Remember , you need to specify border attribute.If you do not specify a border attribute, the table will be displayed without borders. Sometimes this can be useful, but most of the time, we want the borders to show.

Below is the simple example of table with border.

<html>
<head>
<title> The eighth lesson </title>
</head>
<body>
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
</body>
</html>

You can also put header in the table. Header information in a table are defined with the <th> tag.The text in a th element will be bold and centered.

For example :

<html>
<head>
<title> The eighth lesson </title>
</head>
<body>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
</body>
</html>

There are other attributes can be put together in table syntax.

Attribute
Description
cellpadding
Give tables a little extra space between the border of the cell and the text
cellspacing
Give tables a little extra space between the cells of a table
colspan
Merge two colums
rowspan Merge two rows

For example

<table border= "1" cellpadding="10">

In conclusion,the HTML Tables requires start and end tags.This syntax can be added in body section.

Forget to put end tags , will make your table not created.


Wednesday, June 30, 2010

:: HTML Elements Part 7 ::

HTML Images is used to display image/s.It uses <img> tag and the src attribute.The <img> tag is empty, which means that it contains attributes only, and has no closing tag.To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display.

Syntax for defining an image:

<<img src="url" alt="text" />

HTML The Alt Attribute

The required alt attribute specifies an alternate text for an image, if the image cannot be displayed.The value of the alt attribute is an author-defined text:

<img src="ensem.gif" alt="Ensem" />

The alt attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).

For example :

<html>
<head>
<title> The seventh lesson </title>
</head>
<body>
<img src="ensem.gif" alt="Ensem" />
<img src="www.mutak.com/ensem.gif" alt="Ensem" />
</body>
</html>

In conclusion , the HTML Images do not require end tags. This syntax can be added in body section.

Making too many images can make loading images take long time.


Monday, June 28, 2010

:: HTML Elements Part 6 ::

Links are found in nearly all Web Pages. Links allow users to click their way from page to page.

HTML Hyperlinks(Links)

A hyperlink (or link) is a word, group of words, or image that you can click on to jump to a new document or a new section within the current document.When you move the cursor over a link in a Web page, the arrow will turn into a little hand.Links are specified in HTML using the <a> tag.The <a> tag can be used in two ways:

  1. To create a link to another document, by using the href attribute
  2. To create a bookmark inside a document, by using the name attribute
HTML Link Syntax

The HTML code for a link is simple. It looks like this:

<html>
<head>
<title> The sixth lesson </title>
</head>
<body>
<a href="url">Link text</a>
</body>
</html>

The href attribute specifies the destination of a link.

HTML Links-The target Attribute

The target attribute specifies where to open the linked document.The example below will open the linked document in a new browser window:

Example :

<a href="http://www.mutak.com/" target="_blank">Mutak Pages!</a>

HTML Links - The name Attribute

The name attribute specifies the name of an anchor.The name attribute is used to create a bookmark inside an HTML document.Bookmarks are not displayed in any special way. They are invisible to the reader.

Example

A named anchor inside an HTML document:

<a name="tips">New Section</a>

Create a link to the "New Section" inside the same document:

<a href="#tips">New Section</a>

Or, create a link to the "New Section" from another page:

<a href="http://www.mutak/links.htm#tips">New Section</a>

In conclusion , the HTML Links requires both start and end tags. This syntax can be added in body section. Forget to use end tag can make all html pages be hyperlinks.


Sunday, June 27, 2010

:: HTML Elements Part 5 ::

HTML Formatting Tags

To making your website more attractive , you need HTML Formatting Tags. There are many HTML Formatting Tags was provided in HTML Documents. HTML uses tags like <b> and <i> for formatting output, like bold or italic text.These HTML tags are called formatting tags.

HTML Text Formatting Tags

Tag Description
<b> Defines bold text
<big> Defines big text
<em> Defines emphasized text
<i> Defines italic text
<small> Defines small text
<strong> Defines strong text
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text

HTML Computer Output Tags


Tag Description
<code> Defines computer code text
<kbd> Defines keyboard text
<samp> Defines sample computer code
<tt> Defines teletype text
<var> Defines a variable
<pre> Defines preformatted text

HTML Citation,Quotation and Definition Tags


Tag Description
<abbr> Defines an abbreviation
<acronym> Defines an acronym
<address> Defines contact information for the author/owner of a document
<bdo> Defines the text direction
<blockqoute> Defines a long quotation
<q> Defines a short quotation
<cite> Defines a citation
<dfn> Defines a definition term

For example :

<html>
<head>
<title> The fifth lesson </title>
</head>
<body>
<b>This is a bold text </b>
</body>
</html>

To better understanding , you should try all these tags. But remember all these tags requires start and end tags !!

Saturday, June 26, 2010

:: HTML Elements Part 4 ::

Choosing font or heading is very important in creating html pages . Both font and heading almost same but have different function and used in different situation.

HTML Headings

Headings are important in HTML documents. Headings are defined with the <h1> to <h6>.<h1> is the largest heading while <h6> is the smallest heading. This syntax requires both start /opening tag and end/closing tag. The closing tag (i.e <h1>) will be used when users do not want to use it. Use HTML headings for headings only. Do not use it to make text big or bold. Search engines use headings to index the structure and content of web pages. It is important to use headings to show the document structure. H1 headings should be used as main headings , followed by H2 headings then the less important H3 headings and so on.


For example :

<html>
<head>
<title> The fourth lesson </title>
</head>
<body>
<h1>This is H1 heading </h1>
<h2>This is H2 heading </h2>
<h3>This is H3 heading </h3>
</body>
</html>

HTML Fonts

The <font> tag specifies the font face,font size and font color of text.The end/closing tag will be used to make limit the words that will be affected by attributes of fonts.

For example

<html>
<head>
<title> The fourth lesson </title>
</head>
<body>
<font color="FFFFFF" face="verdana" size="3">This is the example using attributes of font </font>
</body>
</html>

Optional Attributes

Attribute Value Description
color rgb(x,x,x)
#xxxxxx
colorname
Deprecated. Use styles instead.
Specifies the color of text
face font_family Deprecated. Use styles instead.
Specifies the font of text
size number Deprecated. Use styles instead.
Specifies the size of text

Standard Attributes

The <p> tag also supports the following standard attributes:

Attribute Value Description
class classname Specifies a classname for an element
dir rtl
ltr
Specifies the text direction for the content in an element
id id Specifies a unique id for an element
lang language_code Specifies a language code for the content in an element
style style_definition Specifies an inline style for an element
title text Specifies extra information about an element

Using the standard attributes will make complicated. To avoid it, I will not recommend web developer to use it. But if they know how to use it, they may use it.

Tip: Use CSS to define the font face, font size, and font color of text.

Now , you already learned and know about HTML Headings and Fonts.Selamat Mencuba !!