
How to Use Tailwind CSS for Faster Web Design
How to Use Tailwind CSS for Faster Web Design Web development has evolved significantly in the past few years, with various tools and frameworks simplifying…
Web Development

LET’S BUILD SOMETHING USEFUL
Talk to Ataraxy Developers about your website, app, or custom software.
In today’s competitive digital landscape, having a portfolio website is essential for showcasing your skills, projects, and achievements. Whether you’re a web developer, designer, photographer, or creative professional, a well-structured portfolio can help you stand out. Using Tailwind CSS, a utility-first CSS framework, you can build a modern, responsive, and visually appealing portfolio website with minimal effort.
This blog will walk you through the step-by-step process of building a portfolio website using Tailwind CSS, from setting up your development environment to creating a fully functional and stylish portfolio.
Before diving into the development process, let’s explore why Tailwind CSS is an excellent choice for building your portfolio website:
Start by creating a new project folder for your portfolio website. Inside this folder, you’ll install Tailwind CSS and set up the necessary files.
mkdir portfolio-website
cd portfolio-website
Next, you need to install Tailwind CSS via npm. Run the following commands to initialize a new project and install Tailwind:
npm init -y
npm install -D tailwindcss
npx tailwindcss init
This will create a tailwind.config.js file, where you can customize Tailwind’s default settings if needed.
Open your tailwind.config.js file and specify the paths to all your template files, such as HTML and JavaScript, to ensure Tailwind generates the necessary styles.
module.exports = {
content: [
'./public/**/*.html',
'./src/**/*.js',
],
theme: {
extend: {},
},
plugins: [],
}
In your project, create a src/styles.css file and import Tailwind’s base, components, and utilities:
@tailwind base;
@tailwind components;
@tailwind utilities;
To generate your final CSS, run the following command:
npx tailwindcss -o public/styles.css --watch
This command will create a styles.css file in the public folder, which you can link to your HTML file.
Now that the Tailwind setup is complete, let’s move on to building the portfolio website structure.
In the public folder, create an index.html file. The basic structure of your portfolio site includes sections like a header, about me, projects, and contact. Here’s an example of the HTML structure:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Portfolio</title>
<link rel="stylesheet" href="styles.css">
</head>
<body class="font-sans bg-gray-100 text-gray-900">
<!-- Header Section -->
<header class="bg-blue-600 text-white">
<div class="container mx-auto p-5 flex justify-between items-center">
<h1 class="text-3xl font-bold">My Portfolio</h1>
<nav>
<a href="#about" class="ml-4">About</a>
<a href="#projects" class="ml-4">Projects</a>
<a href="#contact" class="ml-4">Contact</a>
</nav>
</div>
</header>
<!-- About Section -->
<section id="about" class="container mx-auto my-12 p-5">
<h2 class="text-2xl font-semibold mb-4">About Me</h2>
<p>I am a web developer with a passion for creating interactive and responsive web applications...</p>
</section>
<!-- Projects Section -->
<section id="projects" class="bg-gray-200 py-12">
<div class="container mx-auto p-5">
<h2 class="text-2xl font-semibold mb-4">Projects</h2>
<!-- Project Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-white shadow-lg p-4">
<h3 class="text-xl font-bold">Project 1</h3>
<p>Short description of the project...</p>
</div>
<div class="bg-white shadow-lg p-4">
<h3 class="text-xl font-bold">Project 2</h3>
<p>Short description of the project...</p>
</div>
<div class="bg-white shadow-lg p-4">
<h3 class="text-xl font-bold">Project 3</h3>
<p>Short description of the project...</p>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="container mx-auto my-12 p-5">
<h2 class="text-2xl font-semibold mb-4">Contact Me</h2>
<form action="#" method="POST">
<div class="mb-4">
<label for="name" class="block text-sm font-medium">Name</label>
<input type="text" id="name" name="name" class="w-full border border-gray-300 p-2 mt-1 rounded">
</div>
<div class="mb-4">
<label for="email" class="block text-sm font-medium">Email</label>
<input type="email" id="email" name="email" class="w-full border border-gray-300 p-2 mt-1 rounded">
</div>
<button type="submit" class="bg-blue-600 text-white p-2 rounded">Submit</button>
</form>
</section>
<footer class="bg-blue-600 text-white text-center p-4">
<p>© 2024 My Portfolio</p>
</footer>
</body>
</html>
Tailwind CSS allows you to add custom styling directly in your HTML using its utility classes. Let’s break down how to style different sections of your portfolio:
<header class="bg-blue-600 text-white">
<div class="container mx-auto p-5 flex justify-between items-center">
<h1 class="text-3xl font-bold">My Portfolio</h1>
<nav>
<a href="#about" class="ml-4">About</a>
<a href="#projects" class="ml-4">Projects</a>
<a href="#contact" class="ml-4">Contact</a>
</nav>
</div>
</header>
Here, the header has a blue background, white text, and uses Tailwind’s flexbox utilities to align the items. The links have spacing added with ml-4.
<section id="about" class="container mx-auto my-12 p-5">
<h2 class="text-2xl font-semibold mb-4">About Me</h2>
<p>I am a web developer with a passion for creating interactive and responsive web applications...</p>
</section>
This section uses Tailwind’s spacing utilities like my-12 for vertical margins and p-5 for padding.
For the projects, we use Tailwind’s grid system to create a responsive layout:
<section id="projects" class="bg-gray-200 py-12">
<div class="container mx-auto p-5">
<h2 class="text-2xl font-semibold mb-4">Projects</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<!-- Project Cards -->
</div>
</div>
</section>
The grid automatically adapts for mobile and larger screens using responsive classes (grid-cols-1 for mobile and md:grid-cols-3 for larger screens).
Tailwind CSS makes it easy to create a responsive portfolio website. By using responsive utilities like md:grid-cols-3 or lg:w-1/2, you can ensure that your website looks great on all devices.
For example:
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-white shadow-lg p-4">
<h3 class="text-xl font-bold">Project 1</h3>
<p>Short description of the project...</p>
</div>
</div>
This structure creates a single-column layout on mobile and switches to three columns on medium-sized screens.
You can customize Tailwind’s default theme by editing the tailwind.config.js file. For instance, you can add custom colors, spacing, or fonts to match your personal style.
Example:
theme: {
extend: {
colors: {
primary: '#3490dc',
secondary: '#ffed4a',
danger: '#e3342f',
},
},
},
This customization allows you to create a unique look for your portfolio.
Once your portfolio website is complete, you can deploy it using services like Netlify, Vercel, or GitHub Pages. These platforms allow you to easily host your static site for free.
To deploy on Netlify, follow these steps:
Building a portfolio website using Tailwind CSS is a straightforward process that empowers you to create a professional, responsive, and visually stunning site. Tailwind’s utility-first approach allows you to focus on design and layout without spending too much time writing custom CSS. By following the steps in this blog, you’ll have a modern portfolio website that highlights your work and leaves a lasting impression on potential clients or employers.
LET’S BUILD SOMETHING USEFUL
Talk to Ataraxy Developers about your website, app, or custom software.