CSS Tutorial

Introduction

Edit Template

CSS Tutorial

Introduction

Edit Template

CSS Forms

Forms are an essential part of every website — especially when users need to sign up, log in, or submit data. HTML creates the structure, but CSS turns that structure into something visually appealing and user-friendly.

Let’s create a Registration Form and style it beautifully with CSS.

Basic HTML Registration Form (Unstyled)

Here’s a simple form structure without any CSS:

				
					<!DOCTYPE html>
<html lang="en">
<head>
  <title>User Registration – Learn With Arshyan</title>
</head>
<body>

  <section>
    <h2>Register Your Account</h2>
    <form>
      <label for="fullname">Full Name:</label><br>
      <input type="text" id="fullname" placeholder="Enter your full name"><br><br>

      <label for="username">Username:</label><br>
      <input type="text" id="username" placeholder="Choose a username"><br><br>

      <label for="email">Email Address:</label><br>
      <input type="email" id="email" placeholder="Enter your email"><br><br>

      <label for="password">Password:</label><br>
      <input type="password" id="password" placeholder="Create a password"><br><br>

      <label for="confirm">Confirm Password:</label><br>
      <input type="password" id="confirm" placeholder="Repeat your password"><br><br>

      <input type="submit" value="Register">
      <input type="reset" value="Clear">
    </form>
  </section>

</body>
</html>

				
			
Registration form without CSS

Without styling, this form looks plain and basic. Let’s fix that.

Styling the Form with CSS

Now we’ll add a clean and modern design using CSS:

				
					body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #eef3f7;
  margin: 0;
  padding: 40px;
}

section {
  background-color: #ffffff;
  width: 400px;
  margin: auto;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h2 {
  text-align: center;
  color: #2c3e50;
}

form {
  margin-top: 20px;
}

label {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
  color: #34495e;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 10px;
  margin-bottom: 18px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

input[type="submit"],
input[type="reset"] {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: none;
  font-weight: bold;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

input[type="submit"] {
  background-color: #27ae60;
}

input[type="reset"] {
  background-color: #c0392b;
}

input[type="submit"]:hover {
  background-color: #1e8449;
}

input[type="reset"]:hover {
  background-color: #922b21;
}

				
			

Result – Stylish Registration Form

After applying the CSS, your form now has:

  • A centered, card-style layout

  • Smooth input spacing and borders

  • A vibrant color scheme for buttons

  • Clean, modern hover effects

Tip from Learn With Arshyan

A well-designed form improves user experience, builds trust, and encourages more users to complete it.

You can now try customizing this form further by changing:

  • Background colors

  • Font sizes and families

  • Border radii or shadows

  • Adding input validation or animations

Scroll to Top