Creating a Personalized Greeting Card with HTML CSS and JavaScript Last Updated : 23 Jul, 2024 Comments Improve Suggest changes Like Article Like Report In this article, we are going to learn how to create a Personalized Greeting Card with HTML, CSS, and JavaScript.Output Preview:PrerequisitesHTMLCSSJavaScriptApproach:Create a JavaScript function called customizeCard.Utilize the prompt function to gather user input for a new greeting and a new message.Validate user input by checking if both the new greeting and new message are not null.Use document.getElementById to select HTML elements with the IDs 'greeting' and 'message'.Update the text content of these elements with the user-provided values, effectively customizing the card based on the entered information. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <title>Personalized Greeting Card</title> </head> <body> <div class="card"> <h1 id="greeting">Happy Birthday!</h1> <div id="message"> Wishing you a fantastic day filled with joy and celebration. </div> <button onclick="customizeCard()"> Customize </button> </div> <script src="script.js"></script> </body> </html> CSS body { font-family: 'Arial', sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; } .card { text-align: center; padding: 20px; border: 2px solid #ccc; border-radius: 10px; max-width: 400px; background-color: #fff; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } button { margin-top: 10px; padding: 8px 16px; font-size: 16px; cursor: pointer; } JavaScript function customizeCard() { let newGreeting = prompt("Enter a new greeting:"); let newMessage = prompt("Enter a new message:"); if (newGreeting !== null && newMessage !== null) { document.getElementById('greeting') .textContent = newGreeting; document.getElementById('message') .textContent = newMessage; } } Output: Comment More infoAdvertise with us Next Article Creating a Personalized Greeting Card with HTML CSS and JavaScript A aditiyadav20102001 Follow Improve Article Tags : JavaScript Web Technologies Geeks Premier League Web Development Projects Geeks Premier League 2023 +1 More Similar Reads Create a Toggle Profile Card Details using HTML CSS and JavaScript In this article, we will develop an interactive Toggle Profile Card Details application using HTML, CSS, and JavaScript Language. In this application, we have a Card Component with the user's details like their profile picture and Name. There is a toggle button, and when the button is clicked, the d 3 min read Design a Nested Chat Comments using HTML CSS and JavaScript In this article, we will learn how to create Nested Comments using JavaScript. We must have seen it on social media like Facebook, Instagram, Youtube, Twitter, etc. We have seen the use of the nested comment in the comment section of these social sites.Approach:Create a folder nested-comments on you 2 min read Create an QR Code Generator Project using HTML CSS & JavaScript Today, more than 75% of websites and apps use QR codes to share links, contact info, or event details quickly. Here, youâll learn how to make your own QR Code Generator using HTML, CSS, and JavaScript. Weâll guide you step by step, so even if youâre a beginner, you can follow along easily. By the en 3 min read Create a Guestbook using HTML CSS and JavaScript This article will show how to create a GuestBook using HTML, CSS, and JavaScript that allows users to add their name, mobile number, room number, and address to the guestbook. We have written a code that generates a card with multiple input boxes and a submit button to store the guest's information 3 min read Create A Draggable Card Slider in HTML CSS & JavaScript In this article, we will demonstrate how to create a draggable card slider using HTML, CSS, and JavaScript. We'll use a GeeksforGeeks card slider as an example and implement the functionality to slide cards left and right using arrow buttons. Additionally, we'll incorporate the draggable option, all 5 min read How to create Alarm Setter Card in Tailwind CSS and JavaScript ? The Alarm Setter app is a web application built with HTML, Tailwind CSS, and JavaScript. It allows users to input and set an alarm time, receiving timely notifications upon match. Through its design and functionality, users enjoy a seamless experience managing alarms. The application also includes a 3 min read How to create a dynamic report card using HTML, CSS and JavaScript ? We have to build a website where you can upload your student data like their name and marks in different subjects. And after uploading it will insert the student data in the table as well as, it will show the total marks, average, and pass/fail status. The implementation is done by using HTML and Ja 2 min read How to Create a Portfolio Website using HTML CSS and JavaScript ? A portfolio website is a website that represents you online on the web pages. It contains different sections like Introduction to Yourself, About You, Your Services, Your Contact Details, and Your Portfolio. We are going to build all of the sections with an interactive and attractive web design that 15+ min read Create a Testimonial Card Using HTML and CSS In this tutorial, we're going to create a testimonial card that can be used on websites to display feedback from clients or customers. Testimonials are an excellent way to add social proof to your site, enhancing credibility and trust among visitors. Weâll create a testimonial card with:A speech bub 4 min read Build a Memory Card Game Using HTML CSS and JavaScript A memory game is a type of game that can be used to test or check the memory of a human being. It is a very famous game. In this game, the player has some cards in front of him and all of them facing down initially. The player has to choose a pair of cards at one time and check whether the faces of 6 min read Like