Written by: Geoffrey Callaghan

Create a bootstrap contact form

Create A Bootstrap Contact Form

Bootstrap is a great library for creating stylish and responsive forms with ease. Below is an example of a simple Bootstrap contact form using FabForm:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Contact Form</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fabform/dist/css/fabform.min.css">
</head>
<body>

<div class="container mt-5">
  <div class="row justify-content-center">
    <div class="col-md-6">
      <form id="contactForm" class="fabform">
        <div class="form-header">
          <h2>Contact Us</h2>
        </div>
        <div class="form-group">
          <label for="name">Name</label>
          <input type="text" id="name" name="name" class="form-control" required>
        </div>
        <div class="form-group">
          <label for="email">Email</label>
          <input type="email" id="email" name="email" class="form-control" required>
        </div>
        <div class="form-group">
          <label for="message">Message</label>
          <textarea id="message" name="message" rows="5" class="form-control" required></textarea>
        </div>
        <div class="form-footer">
          <button type="submit" class="btn btn-primary">Submit</button>
        </div>
      </form>
    </div>
  </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/fabform/dist/js/fabform.min.js"></script>
<script>
  // Initialize FabForm
  const form = document.getElementById('contactForm');
  new FabForm(form);
</script>

</body>
</html>

This form includes fields for name, email, and message, and a submit button. FabForm takes care of styling and form validation. You can further customize it according to your needs.