Adding border to form : form « Form « HTML / CSS






Adding border to form

  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
label {
 margin-top: .33em;
 display: block;
}
input {
    display: block;
    width: 250px;
}
textarea {
    width: 250px;
    height: 75px;
}
label.required {
 color: #c00;
 font-weight: bold;
}
textarea.required, input.required  {
 border: 1px solid red;
 background-color: #eee;
}
</style>
</head>

<body>
   <form id="msgform" name="msgform" method="post" action="/process.php">
   <fieldset>
    <legend>Contact Information</legend>
    <label for="fmtitle" accesskey="i">T<span class="akey">i</span>tle</label>
    <select name="fmtitle" id="fmtitle">
     <option value="ms">Ms.</option>
     <option value="mrs">Mrs.</option>
     <option value="miss">Miss</option>
     <option value="mr">Mr.</option>
    </select>
    <label for="fmname" accesskey="n"><span class="akey">N</span>ame</label>
    <input type="text" name="fmname" id="fmname" />
    <label for="fmemail" accesskey="e" class="required">
  <span class="akey">E</span>mail <img src="alert.gif" /> Required</label>
    <input type="text"  name="fmemail" id="fmemail" class="required" />
   </fieldset>
   <fieldset>
    <legend>Your Message</legend>
    <label for="fmstate" accesskey="y">Subject</label>
    <input type="text" name="fmcountry" id="fmcountry" />
    <label for="fmmsg" class="required"><span class="akey">M</span>essage 
  <img src="alert.gif" /> Required</label>
    <textarea name="fmmsg" accesskey="m" id="fmmsg" rows="5" cols="14" 
  class="required"></textarea>
   </fieldset>
   <input type="submit" name="submit" value="send" class="submit" />
  </form>
</body>

</html>

   
    
  








Related examples in the same category

1.Introducing Form Design
2.form starts the form, gives the method of sending information and the location of form scripts
3.Add form controls to paragraph
4.Use DL, DT to layout the form controls
5.A login form with submit button
6.simple form with label, text field and submit button
7.Set margin, padding and border for form
8.Use DIV to wrap form control
9.Wrap form controls in a DIV and set style to float left and padding
10.Use table to layout form controls
11.styleless order form
12.Use UL and LI to layout form controls
13.Define style based on form id
14.Styling text in form controls
15.Disable a form control
16.Align the form controls
17.Registration Form
18.Layout form controls with table
19.Form layout
20.Layout form with CSS
21.Wizard form
22.Form for registration
23.form width: 75%
24.form margin: 3em auto
25.Add BR to table cell to layout the form controls
26.Use table to align the form controls
27.Table and Form Example
28.form margin:10px;
29.form padding: 0 5px;
30.form background: #F5F5F5;
31.form background: #F8F8F8;
32.form padding-right: 15px;
33.form padding-left: 15px;
34.form margin: 15px;
35.form padding: 15px 5px;
36.form border: 1px solid #EFEFEF;
37.Error Fields
38.Error Fields 3
39.Error Fields 2
40.CSS Forms: Focus and Required Fields
41.CSS styled form elements
42.Spreadsheet form
43.A simple search form
44.Register with us form
45.Form with border
46.Submit form
47.Reset and Submit Example