HTML Formats (Tag, Values and Examples), Cheat Sheet of Computer Science

The different attributes and description values of HTML form tags, such as <form>, <input>, <fieldset>, and <legend>. It provides sample codes of forms with text and password inputs, radio buttons and check boxes, and a fieldset with submit and reset buttons. how to create an HTML form for user input and how to group related elements in a form.

Typology: Cheat Sheet

2022/2023

Available from 01/19/2023

nocturnalkid
nocturnalkid 🇵🇭

3 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
HTML FORMS
TAG
ATTRIBUTES & DESCRIPTION
VALUES
<form>
- used to create an HTML form for user
input.
name
- specifies the name of the form
text
<input>
- specifies an input field where the user
can enter data.
type
specifies the type <input> element to
display
button
checkbox
password
radio
text
submit
reset
name
- specifies the name of an <input> element
text
value
- specifies the value of an <input>
element
text
size
- specifies the width, in characters, of an
<input> element
number
<fieldset>
- used to group related elements in a
form.
<legend>
- defines a caption for the <fieldset>
element.
SAMPLE CODES
EXAMPLE OF A FORM WITH TEXT AND PASSWORD INPUTS
SOURCE CODE 1
<html><body>
<form>
FULL NAME : <input type="text" size="50" value="Type here"name="fullname">
<br><br>
PASSWORD : <input type="password" size="30" name="passwd">
</form>
</body>
</html>
OUTPUT:
EXAMPLE OF A FORM WITH RADIO BUTTONS AND CHECK BOXES
SOURCE CODE
<html>
<body>
<form>
pf3

Partial preview of the text

Download HTML Formats (Tag, Values and Examples) and more Cheat Sheet Computer Science in PDF only on Docsity!

HTML FORMS

TAG ATTRIBUTES & DESCRIPTION VALUES

- used to create an HTML form for user input.

name

  • specifies the name of the form

text

- specifies an input field where the user can enter data.

type

  • specifies the type element to

display

button

checkbox

password

radio

text

submit

reset

name

  • specifies the name of an element

text

value

  • specifies the value of an element

text

size

  • specifies the width, in characters, of an element

number

  • used to group related elements in a form.

  • defines a caption for the

element.

SAMPLE CODES

EXAMPLE OF A FORM WITH TEXT AND PASSWORD INPUTS SOURCE CODE 1

FULL NAME :

PASSWORD :

OUTPUT: EXAMPLE OF A FORM WITH RADIO BUTTONS AND CHECK BOXES SOURCE CODE

Are you happy today?
YES NO

How do you feel today? Choose at least one.
Happy
Sad
Sleepy
Hungry
Excited
Super

OUTPUT: EXAMPLE OF A FORM WITH A FIELDSET AND SUBMIT AND RESET BUTTONS SOURCE CODE

BASIC INFORMATION: NAME :
AGE :
HOMETOWN :


OUTPUT: