Hello, developers! I'm excited to share my latest project: aProfile Card. This simple yet elegant project is a great way to showcase your front-end development skills while creating a reusable component for personal or professional use. Whether you're building a personal portfolio or a business website, this Profile Card can add a polished and professional touch to your web pages.
TheProfile Cardproject is a web-based component that displays a user's profile picture, name, status, and a brief description. It's designed to be interactive, allowing users to add or remove friends with just a click of a button. This project demonstrates how to work with dynamic content, event listeners, and conditional rendering using JavaScript.
Here's an overview of the project structure:
Profile-Card/ ├── index.html ├── style.css └── script.js
To get started with the project, follow these steps:
Clone the repository:
git clone https://github.com/abhishekgurjar-in/Profile-Card.git
Open the project directory:
cd Profile-Card
Run the project:
The index.html file defines the structure of the Profile Card, including the header, main content area, and footer. Here’s a snippet:
The style.css file styles the Profile Card, ensuring it's visually appealing and responsive. Below are some key styles:
body { width: 100%; height: 100%; } .header { font-family: sans-serif; margin: 50px; text-align: center; } #main { display: flex; align-items: center; justify-content: center; gap: 20px; width: 100%; height: 65vh; } #card { display: flex; flex-direction: column; align-items: center; padding: 20px; border-radius: 10px; width: 200px; height: 300px; background-color: #ffffff; } #card #img { width: 60px; height: 60px; border-radius: 50%; margin-bottom: 10px; overflow: hidden; } #card button { padding: 12px 22px; color: #fff; border: none; border-radius: 5px; } .footer { margin: 50px; text-align: center; }
The script.js file contains the logic for dynamically generating the Profile Cards and handling user interactions. Here's a snippet:
var arr = [ { name: "Alexander", img: "https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?q=80&w=1887&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", status: "Stranger", }, { name: "Alex", img: "https://images.unsplash.com/photo-1549780101-0c96c7eafbd9?q=80&w=1886&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", status: "Stranger", }, ]; function print() { var clutter = ""; arr.forEach(function (val, index) { clutter += ``; }); document.querySelector("#main").innerHTML = clutter; } print(); document.querySelector("#main").addEventListener("click", function (details) { arr[details.target.id].status = "Friends"; print(); });${val.name}
${val.status}
Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia consequatur nobis natus. Provident?
You can check out the live demo of the Profile Card project here.
The Profile Card project was an enjoyable experience, allowing me to practice essential front-end skills such as HTML, CSS, and JavaScript. I hope this project inspires you to create your own interactive components and continue honing your development skills. Happy coding!
This project was developed as part of my continuous learning journey in front-end development, with a focus on creating interactive and reusable web components.
The above is the detailed content of Build a Profile Card Website. For more information, please follow other related articles on the PHP Chinese website!