Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Implementing the Contact Form | Creating a Portfolio Website with Bootstrap
Bootstrap Essentials for Modern Websites

book
Implementing the Contact Form

1. Add the Contact Form Section

Create a section at the bottom of the page to accommodate the contact form.

<section id="contact" class="contact-section py-5 bg-secondary">
<div class="container">
<div class="row">
<div class="col-md-8 mx-auto">
<h2 class="text-center mb-4 text-light">Contact Me</h2>
<!-- Add the contact form here -->
<form>
<div class="mb-3">
<label for="name" class="form-label text-light">Name</label>
<input
type="text"
class="form-control"
id="name"
placeholder="Enter your name"
/>
</div>
<div class="mb-3">
<label for="email" class="form-label text-light">Email</label>
<input
type="email"
class="form-control"
id="email"
placeholder="Enter your email"
/>
</div>
<div class="mb-3">
<label for="message" class="form-label text-light">Message</label>
<textarea
class="form-control"
id="message"
rows="5"
placeholder="Enter your message"
></textarea>
</div>
<button type="submit" class="btn btn-warning">Submit</button>
</form>

2. Create the Contact Form

Within the form, use Bootstrap's form components to create input fields for name, email, message, etc. Customize the form labels, placeholders, and button text as needed.

Result

html

index.html

copy
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Portfolio</title>
<!-- Bootstrap CSS -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
</head>
<body>
<!-- Build Header Navigation -->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">My Portfolio</a>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="#about">About Me</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#experience">Experience</a>

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 5. Capítulo 7
We use cookies to make your experience better!
some-alt