Add style for a user registration form in HTML and CSS

Description

The following code shows how to add style for a user registration form.

Example


<!--from w  ww  .jav  a2 s.com-->
<html>
<head>
<style>
input.txt {
  color: #00008B;
  background-color: #E3F2F7;
  border: 1px inset #00008B;
  width: 200px;
}

input.btn {
  color: #00008B;
  background-color: #ADD8E6;
  border: 1px outset #00008B;
}

form div {
  clear: left;
  margin: 0;
  padding: 0;
  padding-top: 5px;
}

form div label {
  float: left;
  width: 40%;
  font: bold 0.9em Arial, Helvetica, sans-serif;
}

fieldset {
  border: 1px dotted #61B5CF;
  margin-top: 1.4em;
  padding: 0.6em;
}

legend {
  font: bold 0.8em Arial, Helvetica, sans-serif;
  color: #00008B;
  background-color: #FFFFFF;
}
</style>
</head>
<body>
  <h1>User Registration Form</h1>
  <form method="post" action="fieldset.html">
    <fieldset>
      <legend>Personal Information</legend>
      <div>
        <label for="fullname">Name:</label> <input type="text"
          name="fullname" id="fullname" class="txt" />
      </div>
      <div>
        <label for="email">Email Address:</label> <input type="text"
          name="email" id="email" class="txt" />
      </div>
      <div>
        <label for="password1">Password:</label> <input type="password"
          name="password1" id="password1" class="txt" />
      </div>
      <div>
        <label for="password2">Confirm Password:</label> <input
          type="password" name="password2" id="password2" class="txt" />
      </div>
    </fieldset>
    <fieldset>
      <legend>Address Details</legend>
      <div>
        <label for="address1">Address line one:</label> <input type="text"
          name="address1" id="address1" class="txt" />
      </div>
      <div>
        <label for="address2">Address line two:</label> <input type="text"
          name="address2" id="address2" class="txt" />
      </div>
      <div>
        <label for="city">Town / City:</label> <input type="text"
          name="city" id="city" class="txt" />
      </div>
      <div>
        <label for="zip">Zip / Post code:</label> <input type="text"
          name="zip" id="zip" class="txt" />
      </div>
    </fieldset>
    <div>
      <input type="submit" name="btnSubmit" id="btnSubmit" value="Sign Up!"
        class="btn" />
    </div>
  </form>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table