Monday, August 13, 2012

HTML 4.01 Quick List


HTML Quick List from W3Schools. Print it, fold it, and put it in your pocket.

HTML Basic Document

<!DOCTYPE html>
<html>
<head>
<title>Title of document goes here</title>
</head>
<body>
Visible text goes here...
</body>
</html>

Heading Elements

<h1>Largest Heading</h1>
<h2> . . . </h2>
<h3> . . . </h3>
<h4> . . . </h4>
<h5> . . . </h5>
<h6>Smallest Heading</h6>

Text Elements

<p>This is a paragraph</p>
<br /> (line break)
<hr /> (horizontal rule)
<pre>This text is preformatted</pre>

Logical Styles

<em>This text is emphasized</em>
<strong>This text is strong</strong>
<code>This is some computer code</code>

Physical Styles

<b>This text is bold</b>
<i>This text is italic</i>

Links

Ordinary link: <a href="http://www.example.com/">Link-text goes here</a>
Image-link: <a href="http://www.example.com/"><img src="URL" alt="Alternate Text" /></a>
Mailto link: <a href="mailto:webmaster@example.com">Send e-mail</a>
A named anchor:
<a name="tips">Tips Section</a>
<a href="#tips">Jump to the Tips Section</a>

Unordered list

<ul>
  <li>Item</li>
  <li>Item</li>
</ul>

Ordered list

<ol>
  <li>First item</li>
  <li>Second item</li>
</ol>

Definition list

<dl>
  <dt>First term</dt>
    <dd>Definition</dd>
  <dt>Next term</dt>
    <dd>Definition</dd>
</dl>

Tables

<table border="1">
  <tr>
    <th>Tableheader</th>
    <th>Tableheader</th>
  </tr>
  <tr>
    <td>sometext</td>
    <td>sometext</td>
  </tr>
</table>

Iframe

<iframe src="demo_iframe.htm"></iframe>

Forms

<form action="http://www.example.com/test.asp" method="post/get">
<input type="text" name="email" size="40" maxlength="50" />
<input type="password" />
<input type="checkbox" checked="checked" />
<input type="radio" checked="checked" />
<input type="submit" value="Send" />
<input type="reset" />
<input type="hidden" />

<select>
<option>Apples</option>
<option selected="selected">Bananas</option>
<option>Cherries</option>
</select>
<textarea name="comment" rows="60" cols="20"></textarea>

</form>

Entities

&lt; is the same as <
&gt; is the same as >
&#169; is the same as ©

Other Elements

<!-- This is a comment -->
<blockquote>
Text quoted from a source.
</blockquote>
<address>
Written by W3Schools.com<br />
<a href="mailto:us@example.org">Email us</a><br />
Address: Box 564, Disneyland<br />
Phone: +12 34 56 78
</address>
Source : http://www.nabeeljamil.blogspot.com/

HTML Colors


Colors are displayed combining RED, GREEN, and BLUE light.

Color Values

HTML colors are defined using a hexadecimal notation (HEX) for the combination of Red, Green, and Blue color values (RGB).
The lowest value that can be given to one of the light sources is 0 (in HEX: 00). The highest value is 255 (in HEX: FF).
HEX values are specified as 3 pairs of two-digit numbers, starting with a # sign.

Color Values

ColorColor HEXColor RGB
 #000000rgb(0,0,0)
 #FF0000rgb(255,0,0)
 #00FF00rgb(0,255,0)
 #0000FFrgb(0,0,255)
 #FFFF00rgb(255,255,0)
 #00FFFFrgb(0,255,255)
 #FF00FFrgb(255,0,255)
 #C0C0C0rgb(192,192,192)
 #FFFFFFrgb(255,255,255)

Try it yourself »


16 Million Different Colors

The combination of Red, Green, and Blue values from 0 to 255, gives more than 16 million different colors (256 x 256 x 256).

If you look at the color table below, you will see the result of varying the red light from 0 to 255, while keeping the green and blue light at zero.

To see the full list of color mixes when RED varies from 0 to 255, click on one of the HEX or RGB values below.

Red LightColor HEXColor RGB
 #000000 rgb(0,0,0) 
 #080000 rgb(8,0,0) 
 #100000 rgb(16,0,0) 
 #180000 rgb(24,0,0) 
 #200000 rgb(32,0,0) 
 #280000 rgb(40,0,0) 
 #300000 rgb(48,0,0) 
 #380000 rgb(56,0,0) 
 #400000 rgb(64,0,0) 
 #480000 rgb(72,0,0) 
 #500000 rgb(80,0,0) 
 #580000 rgb(88,0,0) 
 #600000 rgb(96,0,0) 
 #680000 rgb(104,0,0) 
 #700000 rgb(112,0,0) 
 #780000 rgb(120,0,0) 
 #800000 rgb(128,0,0) 
 #880000 rgb(136,0,0) 
 #900000 rgb(144,0,0) 
 #980000 rgb(152,0,0) 
 #A00000 rgb(160,0,0) 
 #A80000 rgb(168,0,0) 
 #B00000 rgb(176,0,0) 
 #B80000 rgb(184,0,0) 
 #C00000 rgb(192,0,0) 
 #C80000 rgb(200,0,0) 
 #D00000 rgb(208,0,0) 
 #D80000 rgb(216,0,0) 
 #E00000 rgb(224,0,0) 
 #E80000 rgb(232,0,0) 
 #F00000 rgb(240,0,0) 
 #F80000 rgb(248,0,0) 
 #FF0000 rgb(255,0,0) 


Shades of Gray

Gray colors are created by using an equal amount of power to all of the light sources.
To make it easier for you to select the correct shade, we have created a table of gray shades for you:

Gray ShadesColor HEXColor RGB
 #000000 rgb(0,0,0) 
 #080808 rgb(8,8,8) 
 #101010 rgb(16,16,16) 
 #181818 rgb(24,24,24) 
 #202020 rgb(32,32,32) 
 #282828 rgb(40,40,40) 
 #303030 rgb(48,48,48) 
 #383838 rgb(56,56,56) 
 #404040 rgb(64,64,64) 
 #484848 rgb(72,72,72) 
 #505050 rgb(80,80,80) 
 #585858 rgb(88,88,88) 
 #606060 rgb(96,96,96) 
 #686868 rgb(104,104,104) 
 #707070 rgb(112,112,112) 
 #787878 rgb(120,120,120) 
 #808080 rgb(128,128,128) 
 #888888 rgb(136,136,136) 
 #909090 rgb(144,144,144) 
 #989898 rgb(152,152,152) 
 #A0A0A0 rgb(160,160,160) 
 #A8A8A8 rgb(168,168,168) 
 #B0B0B0 rgb(176,176,176) 
 #B8B8B8 rgb(184,184,184) 
 #C0C0C0 rgb(192,192,192) 
 #C8C8C8 rgb(200,200,200) 
 #D0D0D0 rgb(208,208,208) 
 #D8D8D8 rgb(216,216,216) 
 #E0E0E0 rgb(224,224,224) 
 #E8E8E8 rgb(232,232,232) 
 #F0F0F0 rgb(240,240,240) 
 #F8F8F8 rgb(248,248,248) 
 #FFFFFF rgb(255,255,255) 


Web Safe Colors?

Some years ago, when computers supported max 256 different colors, a list of 216 "Web Safe Colors" was suggested as a Web standard, reserving 40 fixed system colors.

The 216 cross-browser color palette was created to ensure that all computers would display the colors correctly when running a 256 color palette.

This is not important today, since most computers can display millions of different colors. Anyway, here is the list:

0000000000330000660000990000CC0000FF
0033000033330033660033990033CC0033FF
0066000066330066660066990066CC0066FF
0099000099330099660099990099CC0099FF
00CC0000CC3300CC6600CC9900CCCC00CCFF
00FF0000FF3300FF6600FF9900FFCC00FFFF
3300003300333300663300993300CC3300FF
3333003333333333663333993333CC3333FF
3366003366333366663366993366CC3366FF
3399003399333399663399993399CC3399FF
33CC0033CC3333CC6633CC9933CCCC33CCFF
33FF0033FF3333FF6633FF9933FFCC33FFFF
6600006600336600666600996600CC6600FF
6633006633336633666633996633CC6633FF
6666006666336666666666996666CC6666FF
6699006699336699666699996699CC6699FF
66CC0066CC3366CC6666CC9966CCCC66CCFF
66FF0066FF3366FF6666FF9966FFCC66FFFF
9900009900339900669900999900CC9900FF
9933009933339933669933999933CC9933FF
9966009966339966669966999966CC9966FF
9999009999339999669999999999CC9999FF
99CC0099CC3399CC6699CC9999CCCC99CCFF
99FF0099FF3399FF6699FF9999FFCC99FFFF
CC0000CC0033CC0066CC0099CC00CCCC00FF
CC3300CC3333CC3366CC3399CC33CCCC33FF
CC6600CC6633CC6666CC6699CC66CCCC66FF
CC9900CC9933CC9966CC9999CC99CCCC99FF
CCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFF
CCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFF
FF0000FF0033FF0066FF0099FF00CCFF00FF
FF3300FF3333FF3366FF3399FF33CCFF33FF
FF6600FF6633FF6666FF6699FF66CCFF66FF
FF9900FF9933FF9966FF9999FF99CCFF99FF
FFCC00FFCC33FFCC66FFCC99FFCCCCFFCCFF
FFFF00FFFF33FFFF66FFFF99FFFFCCFFFFFF

HTML Iframes


An iframe is used to display a web page within a web page.



Syntax for adding an iframe:

<iframe src="URL"></iframe>

The URL points to the location of the separate page.

Iframe - Set Height and Width

The height and width attributes are used to specify the height and width of the iframe.
The attribute values are specified in pixels by default, but they can also be in percent (like "80%").

Example

<iframe src="http://www.nabeeljamil.blogspot.com/" width="200" height="200"></iframe>

Try it yourself »


Iframe - Remove the Border

The frameborder attribute specifies whether or not to display a border around the iframe.
Set the attribute value to "0" to remove the border:

Example

<iframe src="http://www.nabeeljamil.blogspot.com/" frameborder="0"></iframe>

Try it yourself »


Use iframe as a Target for a Link

An iframe can be used as the target frame for a link.
The target attribute of a link must refer to the name attribute of the iframe:

Example

<iframe src="http://www.nabeeljamil.blogspot.com/" name="Nabeel Jamil"></iframe>
<p><a href="http://www.nabeeljamil.blogspot.com/" target="iframe_a">Nabeel Jamil Blog's</a></p>

Try it yourself »


HTML iframe Tag

TagDescription
<iframe>Defines an inline sub window (frame)

HTML Forms and Input


HTML Forms are used to select different kinds of user input.

Try it Yourself - Examples

Create text fields

How to create text fields. The user can write text in a text field.

Create password field
How to create a password field.
(You can find more examples at the bottom of this page)

HTML Forms

HTML forms are used to pass data to a server.
A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements.
The <form> tag is used to create an HTML form:

<form>
.
input elements
.
</form>


HTML Forms - The Input Element

The most important form element is the input element.
The input element is used to select user information.
An input element can 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.
The most used input types are described below.

Text Fields

<input type="text" /> defines a one-line input field that a user can enter text into:

<form>
First name: <input type="text" name="firstname" /><br />
Last name: <input type="text" name="lastname" />
</form>

How the HTML code above looks in a browser:
First name: 
Last name: 
Note: The form itself is not visible. Also note that the default width of a text field is 20 characters. 

Password Field

<input type="password" /> defines a password field:

<form>
Password: <input type="password" name="pwd" />
</form>

How the HTML code above looks in a browser:
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>

How the HTML code above looks in a browser:
 Male
 Female

Checkboxes

<input type="checkbox" /> defines a checkbox. Checkboxes let a user select ZERO or MORE options of a limited number of choices.

<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>

How the HTML code above looks in a browser:

 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="html_form_action.asp" method="get">
Username: <input type="text" name="user" />
<input type="submit" value="Submit" />
</form>

How the HTML code above looks in a browser:
Username:  
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 "html_form_action.asp". The page will show you the received input.


More Input Examples

Radio buttons
How to create radio buttons.

Checkboxes
How to create checkboxes. A user can select or unselect a checkbox.

Simple drop-down list
How to create a simple drop-down list.

Drop-down list with a pre-selected value
How to create a drop-down list with a pre-selected value.

Textarea
How to create a multi-line text input control. In a text-area the user can write an unlimited number of characters.

Create a button
How to create a button.

Form Examples

Fieldset around form-data
How to create a border around elements in a form.

Form with text fields and a submit button
How to create a form with two text fields and a submit button.

Form with checkboxes
How to create a form with two checkboxes and a submit button.

Form with radio buttons
How to create a form with two radio buttons, and a submit button.

Send e-mail from a form
How to send e-mail from a form.

HTML Form Tags

TagDescription
<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