Build a Profile Card Website
Introduction
Hello, developers! I'm excited to share my latest project: a Profile 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.
Project Overview
The Profile Card project 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.
Features
- Interactive Design: Users can interact with the profile card by adding or removing friends.
- Responsive Layout: The card is designed to look great on various devices and screen sizes.
- Dynamic Content: The profile card dynamically updates its content based on user interactions.
Technologies Used
- HTML: Provides the structure for the profile card.
- CSS: Styles the card, ensuring it is visually appealing and responsive.
- JavaScript: Handles the interactive features, such as updating the card's status and re-rendering content.
Project Structure
Here's an overview of the project structure:
Profile-Card/ ├── index.html ├── style.css └── script.js
- index.html: Contains the HTML structure for the Profile Card.
- style.css: Includes CSS styles for a clean, modern design.
- script.js: Manages the dynamic aspects of the card, such as user interactions and status updates.
Installation
To get started with the project, follow these steps:
-
Clone the repository:
git clone https://github.com/abhishekgurjar-in/Profile-Card.git
Copy after login -
Open the project directory:
cd Profile-Card
Copy after login -
Run the project:
- Open the index.html file in a web browser to view the Profile Card.
Usage
- Open the website in a web browser.
- View the Profile Card displaying the user's information.
- Interact with the card by clicking the "Add Friend" or "Remove Friend" button to update the user's status.
Code Explanation
HTML
The index.html file defines the structure of the Profile Card, including the header, main content area, and footer. Here’s a snippet:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Profile Card</title> <link rel="stylesheet" href="style.css" /> <script src="script.js" defer></script> </head> <body> <div class="header"> <h1>Profile Card</h1> </div> <div id="main"></div> <div class="footer"> <p>Made with ❤️ by Abhishek Gurjar</p> </div> </body> </html>
CSS
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; }
JavaScript
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 += `<div id="card"> <div id="img"> <img src="${val.img}"> </div> <h3>${val.name}</h3> <h5 id="${val.status}">${val.status}</h5> <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia consequatur nobis natus. Provident?</p> <button class="${val.status === "Stranger" ? "blue" : "red"}" id="${index}"> ${val.status === "Stranger" ? "Add Friend" : "Remove Friend"} </button> </div>`; }); document.querySelector("#main").innerHTML = clutter; } print(); document.querySelector("#main").addEventListener("click", function (details) { arr[details.target.id].status = "Friends"; print(); });
Live Demo
You can check out the live demo of the Profile Card project here.
Conclusion
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!
Credits
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.
Author
-
Abhishek Gurjar
- GitHub Profile
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing
