DevPlatform
Home
Components
Search
Submit
Earn
Login
Sign Up Free
Faqs - Preview | DevPlatform
DevPlatform
Categories
Accordion
Animation
Box Shadow
Button
Card
Footer
Form
Gallery
Hero Section
Inputs
Loader
Marquee
Modal
Modules
Navbar
Progress Bar
Radio Buttons
Search-Bar
Sections
Slider
Tab
Timeline
Toggle
Faqs
abhishek001
Jan 25, 2026
6
0
Share
Live Preview
Refresh
Live Editor
HTML
CSS
JS
HTML
CSS
JavaScript
1
<div class="container"> <div class="accordion-item" id="accordionItem"> <div class="accordion-header"> <div class="header-content"> <div class="number">01</div> <div class="header-text"> <h3>What makes this design unique?</h3> <span class="tag">Featured Question</span> </div> </div> <button class="toggle-btn" id="toggleBtn"> <span class="plus-h"></span> <span class="plus-v"></span> </button> </div> <div class="accordion-body"> <div class="body-content"> <p>This accordion features a modern, minimalist design with smooth animations and interactive elements. The unique plus-to-minus transformation, gradient accents, and card-based layout create an engaging user experience.</p> <div class="features"> <div class="feature"> <span class="feature-icon">✓</span> <span>Smooth animations</span> </div> <div class="feature"> <span class="feature-icon">✓</span> <span>Modern design</span> </div> <div class="feature"> <span class="feature-icon">✓</span> <span>Fully responsive</span> </div> </div> <button class="cta-btn">Learn More →</button> </div> </div> </div> </div>
1
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; } .container { max-width: 700px; width: 100%; } .accordion-item { background: white; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); } .accordion-item:hover { box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4); transform: translateY(-5px); } .accordion-header { display: flex; align-items: center; justify-content: space-between; padding: 2rem; cursor: pointer; background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05)); border-bottom: 2px solid transparent; transition: all 0.3s ease; } .accordion-item.active .accordion-header { border-bottom: 2px solid #667eea; } .header-content { display: flex; align-items: center; gap: 1.5rem; flex: 1; } .number { width: 60px; height: 60px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; color: white; box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3); } .header-text { flex: 1; } .header-text h3 { font-size: 1.5rem; color: #2d3748; margin-bottom: 0.5rem; font-weight: 600; } .tag { display: inline-block; padding: 0.4rem 1rem; background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1)); color: #667eea; border-radius: 20px; font-size: 0.85rem; font-weight: 600; border: 1px solid rgba(102, 126, 234, 0.2); } .toggle-btn { width: 50px; height: 50px; background: #f7fafc; border: none; border-radius: 12px; cursor: pointer; position: relative; transition: all 0.3s ease; } .toggle-btn:hover { background: #edf2f7; transform: scale(1.1); } .plus-h, .plus-v { position: absolute; background: #667eea; transition: all 0.3s ease; } .plus-h { width: 20px; height: 3px; top: 50%; left: 50%; transform: translate(-50%, -50%); } .plus-v { width: 3px; height: 20px; top: 50%; left: 50%; transform: translate(-50%, -50%); } .accordion-item.active .toggle-btn { background: #667eea; } .accordion-item.active .plus-h { background: white; } .accordion-item.active .plus-v { transform: translate(-50%, -50%) rotate(90deg); opacity: 0; background: white; } .accordion-body { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1); } .accordion-item.active .accordion-body { max-height: 600px; } .body-content { padding: 2rem; } .body-content p { color: #4a5568; line-height: 1.8; font-size: 1.05rem; margin-bottom: 2rem; } .features { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; } .feature { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: #f7fafc; border-radius: 10px; border-left: 4px solid #667eea; transition: all 0.3s ease; } .feature:hover { background: #edf2f7; transform: translateX(10px); } .feature-icon { width: 28px; height: 28px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 0.9rem; } .feature span:last-child { color: #2d3748; font-weight: 500; } .cta-btn { width: 100%; padding: 1rem 2rem; background: linear-gradient(135deg, #667eea, #764ba2); color: white; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3); } .cta-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4); } .cta-btn:active { transform: translateY(-1px); } @media (max-width: 768px) { .accordion-header { padding: 1.5rem; } .header-content { gap: 1rem; } .number { width: 50px; height: 50px; font-size: 1.25rem; } .header-text h3 { font-size: 1.25rem; } .body-content { padding: 1.5rem; } .body-content p { font-size: 1rem; } }
1
const item = document.getElementById('accordionItem'); const btn = document.getElementById('toggleBtn'); btn.addEventListener('click', () => { item.classList.toggle('active'); });
Comments
0
Want to comment?
Please
login
or
sign up
to post comments.
No comments yet
Be the first to comment on this component!
Comments 0
Want to comment?
Please login or sign up to post comments.
No comments yet
Be the first to comment on this component!