Expt 2
Expt 2
Experiment No 2
Theory:
Introduction:
FORMS IN HTML:
Forms are an interactive feature of many websites.Forms are the primary method for getting data from
visitors of the web site.A form takes the input and sends the data to webserver on clicking submit
button.On the web server backend application scripts will collect the data and store it on the database on
the server.
Creating Forms
To create forms in HTML web page
<form> element is used
It is a container tag which will contain all the form elements
Form Elements
<input> element
The <input> element is the most important form element.
Using <input> tag and its type attribute you can create various form elements.
It is an empty tag.
Attributes of <input> tag
Type - Specifies the type <input> element to display
Name - Specifies the name of an <input> element
Size - Specifies the width (in characters) of an input field
PCET-NMVPM’s
Nutan College of Engineering and Research, Talegaon, Pune
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
CSS Syntax
A CSS rule-set consists of a selector and a declaration block:
The selector points to the HTML element you want to style.
The declaration block contains one or more declarations separated by semicolons.
Inside declaration block, property:value pair is used.
Colon : is used to separate property and value.
To add next property value pair, use ; semi-colon.
PCET-NMVPM’s
Nutan College of Engineering and Research, Talegaon, Pune
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
CSS Styles are usually written inside <style> element under Head Section. This way of styling is Internal
CSS.
INLINE CSS
Inline CSS
Inline CSS allows you to apply a unique style to one HTML element at a time.
You assign CSS to a specific HTML element by using the style attribute with any CSS properties
defined within it.
The style attribute is written in the starting tag of a HTML element
External CSS
An external stylesheet is used when you want to apply one style to whole website (multiple web pages).
The styles are written in a separate file with .css extension. The stylesheet files are linked using the
PCET-NMVPM’s
Nutan College of Engineering and Research, Talegaon, Pune
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
<link> tag which should be placed in the head section of an HTML page. Using External Stylesheets,
You can apply same styles to multiple web pages.
We can have all the three methods applied to a web page. If same CSS property is defined for an element
in Internal, External as well as Inline, then Inline CSS has the highest priority, then comes
Internal/Embedded followed by External CSS which has the least priority.
Use <link> tag in the head section of all these web pages.
<link rel=“stylesheet” type=“text/css” href=“style.css”>
Conclusion:
Hence , we studied the the basic concepts of HTML forms and CSS.