QUIZ 1 QUIZ 2 ASSIGNMENTS  --- CONTENT ---   Introduction HTML Editors Basic HTML Tags Heading Tags Paragraph Tags Line Break Tag Horizontal Lines Preserve Formatting Links Images Formatting Tables Heading Colspan and Rowspan Backgrounds Height and Width Header, Body, and Footer Lists Unordered List UL Types Ordered List OL Types Div Span Forms Fieldset Legend Label Input Select Datalist Textarea

Div

The div tag is used for defining a section of your document. With the div tag, you can group large sections of HTML elements together and format them with CSS. Div can be used extensibly with id and class attributes.

The difference between the div tag and the span tag is that the div tag is used with blocklevel elements whilst the span tag is used with inline elements.

For example:

    			
<div>This is a div</div>
<div id="div2">This is a div as well</div>
    			
    		

Becomes:

This is a div
This is a div as well


Span

The HTML tag is used for grouping and applying styles to inline elements.

This doesnt take up the entire line. Takes up only as much space as the content in it.

For Example:

    			
<span>This is one span.</span>
<span>This is another span.</span>    				
    			
    		

Becomes:

This is one span. This is another span.


Forms

HTML Forms are required, when you want to collect some data from the site visitor. For example, during user registration you would like to collect information such as name, email address, credit card, etc. A form will take input from the site visitor and then will post it to a back-end application such as CGI, ASP Script or PHP script etc. The back-end application will perform required processing on the passed data based on defined business logic inside the application. There are various form elements available like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.

For Example:

    			
<form action = "Script URL" method = "GET|POST">
	form elements like input, textarea etc.
</form>    				
    			
    		

Becomes:

form elements like input, textarea etc.


There are some important attributes associated with forms that control its behaviour.
  1. action

    Backend script ready to process your passed data

  2. method

    Method to be used to upload data. The most frequently used are GET and POST methods.

  3. target

    Specify the target window or frame where the result of the script will be displayed. It takes values like _blank, _self, _parent etc.



Form has several tags associated to it. Let's take a look at them.



Fieldset

It is used to create a border around the form specifying the field in which the form is present.

For Example:

    			
<fieldset>
	<form>
		form elements like input, textarea etc.
	</form>
</fieldset>    				
    			
    		

Becomes:

form elements like input, textarea etc.


Legend

Legend is used to give a heading to the form on the border provided by fieldset

For Example:

    			
<fieldset>
	<legend>Form 1<legend>
	<form>
		form elements like input, textarea etc.
	</form>
</fieldset>    				
    			
    		

Becomes:

Form 1
form elements like input, textarea etc.


Label

Label tag is used to specify what is the value to provide while taking input. We can give details about the type of input we want to take in label.

For Example:

    			
<fieldset>
	<legend>label</legend>
	<form>
		<label>Name(string):</label><br>
		<label>Age(number):</label>
	</form>
</fieldset>    				
    			
    		

Becomes:

label



Input

Input tag is used to allow the user to write andd we can use this data for any purpose we want. Input has the following attributes which determine its behaviour.

  1. type

    Indicates the type of input control and for text input control it will be set to text.

  2. name

    Used to give a name to the control which is sent to the server to be recognized and get the value.

  3. value

    This can be used to provide an initial value inside the control.

  4. size

    Allows to specify the width of the text-input control in terms of characters.

  5. maxlength

    Allows to specify the maximum number of characters a user can enter into the text box.



The type attribute is very important and is used to specify the type of input we take.
  1. text

    Default. Defines a single-line text field.

  2. number

    Defines a field for entering a number

  3. date

    Defines a date control (year, month, day (no time))

  4. radio

    Defines a radio button

  5. checkbox

    Defines a checkbox

  6. email

    Defines a field for an e-mail address

  7. url

    Defines a field for entering a URL

  8. button

    Defines a clickable button

  9. submit

    Defines a submit button

  10. image

    Defines an image as the submit button

  11. password

    Defines a password field

  12. range

    Defines a range control (like a slider control)

  13. reset

    Defines a reset button

  14. file

    Defines a file-select field and a "Browse" button

  15. color

    Defines a color picker

For Example:

    			
<fieldset>
  <legend>Input Type</legend>
  <form>
	<label>Text:</label><br><input type="text" name="name"><br>
	<label>Number:</label><br><input type="number" name="number"><br>
	<label>Date:</label><br><input type="date" name="date"><br>
	<label>Radio:</label><br><input type="radio" name="radio"><br>
	<label>Checkbox:</label><br><input type="checkbox" name="checkbox"><br>
	<label>Email:</label><br><input type="email" name="email"><br>
	<label>URL:</label><br><input type="url" name="url"><br>
	<label>Button:</label><br><input type="button" name="button" value="Send"><br>
	<label>Submit:</label><br><input type="submit" name="submit"><br>
	<label>Password:</label><br><input type="password" name="password"><br>
	<label>Range:</label><br><input type="range" name="range"><br>
	<label>File:</label><br><input type="file" name="file"><br>
	<label>Color:</label><br><input type="color" name="color"><br>
  </form>
</fieldset>    				
    			
    		

Becomes:

Input type




























Select

The tag is used within a form for defining a select list

For Example:

    			
<fieldset>
	<legend>Select</legend>
	<form>
		<label>Branch:</label><br>
		<select>
			<option value="CSE" selected>CSE</option>
			<option value="IT">IT</option>
		</select><br>
		<input type="submit" name="submit">
	</form>
</fieldset>
    			
    		

Becomes:

Select




Datalist

The tag specifies set of options for <input> element.

For Example:

    			
<fieldset>
	<legend>Datalist</legend>
	<form>
		<label>Enter Language of choice:</label>
		<input list = "langs">
			<datalist id = "langs">
			<option value = "C">
			<option value = "C++">
			<option value = "Python">
			<option value = "Java">
			<option value = "GO">
	</form>
</datalist>
    			
    		

Becomes:

Datalist


Textarea

This tag is used within a form to declare a textarea element - a control that allows the user to input text over multiple rows.

For Example:

    			
<fieldset>
	<legend>Textarea</legend>
	<form>
		<label>Enter comments:</label><br><br>
		<textarea></textarea>
	</form>
</fieldset>
    			
    		

Becomes:

Textarea