HTMLify
feedback page
Views: 529 | Author: sachinthakur
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Feedback UI - Designed By || Sachin Dhakrey</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container" id="container"> <h1 class="heading">Feedback UI</h1> <div class="ratings-container" id="ratings-container"> <div class="rating"> <img src="https://cdn-icons-png.flaticon.com/512/166/166527.png" /> <small>Unhappy</small> </div> <div class="rating"> <img src="https://cdn-icons-png.flaticon.com/512/1791/1791385.png" /> <small>Neutral</small> </div> <div class="rating"> <img src="https://cdn-icons-png.flaticon.com/512/166/166538.png" /> <small>Satisfied</small> </div> </div> <button class="btn" id="btn">Send Review</button> </div> <script src="index.js"></script> </body> </html> <style> body { margin: 0; background-color: lightcyan; color: darkgreen; display: flex;j min-height: 100vh; justify-content: center; align-items: center; font-family: monospace; } .container { background: rgba(255, 255, 255, 0.3); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3); border-radius: 10px; padding: 20px; width: 85%; max-width: 400px; text-align: center; font-size: 20px; } .heading { margin: 5px; font-size: 30px; } .ratings-container { display: flex; padding: 20px 0; } .rating { cursor: pointer; padding: 10px; margin: 10px 5px; } .rating:hover, .rating.active { background: darkseagreen; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); color: aliceblue; transition: all 300ms ease; } .btn { background-color: darkcyan; color: aliceblue; border: 0; margin: 10px; border-radius: 4px; padding: 12px 30px; cursor: pointer; } .btn:hover { box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3); transition: all 300ms ease; } .btn:active { transform: scale(0.96); } .rating img { width: 40px; } </style> <script> const ratingEls = document.querySelectorAll(".rating"); const btnEl = document.getElementById("btn"); const containerEl = document.getElementById("container"); let selectedRating = ""; ratingEls.forEach((ratingEl) => { ratingEl.addEventListener("click", (event) => { removeActive(); selectedRating = event.target.innerText || event.target.parentNode.innerText; event.target.classList.add("active"); event.target.parentNode.classList.add("active"); }); }); btnEl.addEventListener("click", () => { if (selectedRating !== "") { containerEl.innerHTML = ` <strong>Thank you!</strong> <br> <br> <strong>Feedback: ${selectedRating}</strong> <p>We'll use your feedback to improve our customer support.</p> `; } }); function removeActive() { ratingEls.forEach((ratingEl) => { ratingEl.classList.remove("active"); }); } </script> |