Create Footers Using React And Tailwind CSS
Last Updated :
24 Sep, 2024
We will learn how to create a responsive footer using React and Tailwind CSS with a modern design. The footer will feature a green background with white text providing a clean and professional look. We will create three sections: Contacts social media and Services to display important information and links. We will use React Icons to enhance the Social Media section with popular platform icons like Facebook Twitter Instagram and LinkedIn.
Prerequisites
Step 1: Set up the project using the command.
npx create-react-app react-app
Step 2: Install node modules using the command.
npm install
cd react-app
Step 3: Install Tailwind CSS using the command.
npm install -D tailwindcss
npx tailwindcss init
Step 4: Configure the tailwind paths in your tailwind.config.js file.
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Step 5: Add tailwind directives to your index.css file.
@tailwind base;
@tailwind components;
@tailwind utilities;
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
Project Structure:
Project folderUpdated Dependencies:
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
Step 6: Install React Icons
npm install react-icons
Example: In this example we will create the footers using react and tailwind CSS
JavaScript
//src/app.jsx
import React from 'react';
import { FaFacebook, FaTwitter, FaInstagram, FaLinkedin } from 'react-icons/fa';
const App = () => {
return (
<footer className="bg-green-600 text-white py-8">
<div className="container mx-auto grid grid-cols-1
md:grid-cols-4 gap-8 w-11/12">
<div className="flex items-center">
<h1 className="text-2xl font-bold">GeeksForGeeks</h1>
</div>
<div>
<h3 className="text-xl font-bold mb-4">Contacts</h3>
<p>Phone: +1 234 567 890</p>
<p>Email: info@example.com</p>
<p>Address: 123 Main Street, City</p>
</div>
<div>
<h3 className="text-xl font-bold mb-4">Social Media</h3>
<div className="flex space-x-4">
<a href="https://facebook.com" target="_blank"
rel="noopener noreferrer">
<FaFacebook className="text-white text-2xl
hover:text-gray-300" />
</a>
<a href="https://twitter.com" target="_blank"
rel="noopener noreferrer">
<FaTwitter className="text-white text-2xl
hover:text-gray-300" />
</a>
<a href="https://instagram.com" target="_blank"
rel="noopener noreferrer">
<FaInstagram className="text-white text-2xl
hover:text-gray-300" />
</a>
<a href="https://linkedin.com" target="_blank"
rel="noopener noreferrer">
<FaLinkedin className="text-white text-2xl
hover:text-gray-300" />
</a>
</div>
</div>
<div>
<h3 className="text-xl font-bold mb-4">Services</h3>
<ul>
<li><a href="#" className="hover:underline">
Web Development</a></li>
<li><a href="#" className="hover:underline">
App Development</a></li>
<li><a href="#" className="hover:underline">
SEO Optimization</a></li>
</ul>
</div>
</div>
</footer>
);
};
export default App;
To start the Application run the following command:
npm start
Output:
Footer using React and Tailwind CSSConclusion
In this article we have created a responsive footer using React and Tailwind CSS styled with a green background and white text. We integrated React Icons to display clickable social media icons. The footer contains different sections for Contacts and social media and Services, and it can easily be adapted for any application.
Similar Reads
Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav
11 min read
Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De
5 min read
Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications
15+ min read
Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Steady State Response In this article, we are going to discuss the steady-state response. We will see what is steady state response in Time domain analysis. We will then discuss some of the standard test signals used in finding the response of a response. We also discuss the first-order response for different signals. We
9 min read
JavaScript Interview Questions and Answers JavaScript (JS) is the most popular lightweight, scripting, and interpreted programming language. JavaScript is well-known as a scripting language for web pages, mobile apps, web servers, and many other platforms. Both front-end and back-end developers need to have a strong command of JavaScript, as
15+ min read
React Tutorial React is a JavaScript Library known for front-end development (or user interface). It is popular due to its component-based architecture, Single Page Applications (SPAs), and Virtual DOM for building web applications that are fast, efficient, and scalable.Applications are built using reusable compon
8 min read
Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read