CodeLens
— Editor
Editor
دروس
myweb
تغییر پروژه
اجرا
پنجره جدید
ذخیره
بازگردانی
تاریخچه
بازنشانی همه
کپی
آماده
HTML
▼
<!DOCTYPE html> <html lang="fa" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CodeLens — Prosjekt</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <div class="logo"></> CodeLens</div> <nav> <a href="#home">خانه</a> <a href="#about">درباره</a> <a href="#contact">تماس</a> </nav> </header> <section id="home" class="hero"> <h1>به <span class="highlight">CodeLens</span> خوش آمدید</h1> <p>پروژه خود را بسازید و کد را همینجا ویرایش کنید</p> <button class="btn" onclick="showMessage()">کلیک کنید</button> </section> <section id="about" class="about"> <h2>درباره ما</h2> <div class="cards"> <div class="card"><h3>HTML</h3><p>ساختار</p></div> <div class="card"><h3>CSS</h3><p>استایل</p></div> <div class="card"><h3>JS</h3><p>تعامل</p></div> </div> </section> <section id="contact" class="contact"> <h2>تماس</h2> <form onsubmit="handleSubmit(event)"> <input type="text" id="name" placeholder="نام شما" required> <input type="email" id="email" placeholder="ایمیل" required> <textarea id="msg" placeholder="پیام" required></textarea> <button type="submit" class="btn">ارسال</button> </form> </section> <footer> <p>© 2026 CodeLens</p> </footer> <div id="toast" class="toast"></div> <script src="script.js"></script> </body> </html>
CSS
▼
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, sans-serif; } body { background: #1a1a2e; color: #e0e0e0; line-height: 1.7; } header { background: #16213e; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #2a2a4a; } .logo { color: #e94560; font-size: 1.3rem; font-weight: bold; } nav { display: flex; gap: 15px; } nav a { color: #c4c4d4; text-decoration: none; padding: 6px 14px; border-radius: 6px; transition: all 0.3s; } nav a:hover { background: #2a3a5e; color: #fff; } .hero { text-align: center; padding: 80px 20px; } .hero h1 { font-size: 2.5rem; margin-bottom: 15px; } .highlight { color: #53d8fb; } .btn { padding: 12px 30px; background: #e94560; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; transition: all 0.3s; margin-top: 20px; } .btn:hover { background: #c73652; transform: translateY(-2px); } .about { padding: 60px 20px; max-width: 1200px; margin: 0 auto; } .about h2 { text-align: center; margin-bottom: 40px; color: #fd971f; } .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; } .card { background: #16213e; padding: 30px; border-radius: 12px; text-align: center; border-top: 4px solid #e94560; transition: all 0.3s; } .card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); } .card h3 { color: #53d8fb; margin-bottom: 10px; } .contact { padding: 60px 20px; max-width: 600px; margin: 0 auto; } .contact h2 { text-align: center; margin-bottom: 30px; color: #a6e22e; } .contact form { display: flex; flex-direction: column; gap: 15px; } .contact input, .contact textarea { padding: 12px 16px; background: #0d0d1a; border: 2px solid #2a2a4a; border-radius: 8px; color: #e0e0e0; font-size: 1rem; transition: all 0.3s; } .contact input:focus, .contact textarea:focus { outline: none; border-color: #e94560; } .contact textarea { min-height: 120px; resize: vertical; } footer { background: #0d0d1a; text-align: center; padding: 25px; color: #75715e; margin-top: 60px; } .toast { position: fixed; bottom: 25px; right: 25px; padding: 14px 24px; background: #2a3a5e; color: #fff; border-radius: 10px; transform: translateY(100px); opacity: 0; transition: all 0.4s; max-width: 400px; } .toast.show { transform: translateY(0); opacity: 1; } .toast.success { background: #2d5a4e; } .toast.error { background: #5a2a4e; } .toast.info { background: #2a4a5e; } @media (max-width: 768px) { header { flex-direction: column; gap: 10px; } .hero h1 { font-size: 1.6rem; } }
JavaScript
▼
// ====== CodeLens — Standard Script ====== function showMessage() { showToast('✅ شما کلیک کردید!', 'success'); } function handleSubmit(event) { event.preventDefault(); const name = document.getElementById('name')?.value || ''; const email = document.getElementById('email')?.value || ''; const msg = document.getElementById('msg')?.value || ''; if (name && email && msg) { showToast('✅ پیام ارسال شد!', 'success'); event.target.reset(); } else { showToast('❌ همه فیلدها را پر کنید', 'error'); } } function showToast(message, type = 'info') { const toast = document.getElementById('toast'); if (!toast) return; toast.textContent = message; toast.className = 'toast ' + type; // Trigger reflow void toast.offsetWidth; toast.classList.add('show'); clearTimeout(toast._timeout); toast._timeout = setTimeout(() => { toast.classList.remove('show'); }, 3500); } // Smooth scroll document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) target.scrollIntoView({ behavior: 'smooth' }); }); }); console.log('%c CodeLens Project Ready ', 'background: #e94560; color: #fff; padding: 6px 12px; border-radius: 4px; font-weight: bold;');
پیشنمایش
انتخاب پروژه
×
تاریخچه — myweb
×
—
ذخیره و بستن
کپی
بستن