Solar Flare Code Block - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Solar Flare Code Block</title> <style> body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #fff3e0; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .code-container { background: #ff9800; padding: 2rem; border-radius: 12px; box-shadow: 0 10px 20px rgba(0,0,0,0.15); position: relative; overflow: hidden; } .code-container::before { content: "☀️ Code Block"; position: absolute; top: -20px; right: -40px; font-size: 4rem; color: rgba(255, 255, 255, 0.1); transform: rotate(45deg); } pre { background: #e65100; color: #fff; padding: 1.5rem; border-radius: 10px; overflow-x: auto; font-size: 1rem; line-height: 1.5; font-family: 'Courier New', Courier, monospace; position: relative; z-index: 1; transition: transform 0.3s ease, background 0.3s ease; } pre:hover { transform: scale(1.02); background: #bf360c; } .line-numbers { counter-reset: line; } .line-numbers code:before { counter-increment: line; content: counter(line); display: inline-block; width: 2rem; text-align: right; margin-right: 1rem; color: #888; } .code-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin-bottom: 1rem; } .code-button { background: #ff9800; border: none; color: white; padding: 0.5rem 1rem; border-radius: 5px; cursor: pointer; transition: background 0.3s ease; display: flex; align-items: center; gap: 0.3rem; } .code-button:hover { background: #f57c00; } .code-button i { font-size: 1rem; } .copied-toast { position: absolute; top: 10px; right: 10px; background: #388e3c; color: white; padding: 0.5rem 1rem; border-radius: 5px; display: none; z-index: 2; } @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } </style> <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script> </head> <body> <div class="code-container"> <div class="copied-toast" id="copiedToast">Copied to clipboard! 😊</div> <div class="code-buttons"> <button type="button" class="code-button" id="copyButton"><i class="fas fa-copy"></i> Copy</button> </div> <pre class="line-numbers"><code> function greet() { console.log("Hello, world! ☀️"); } greet(); </code></pre> </div> <script> document.getElementById('copyButton').addEventListener('click', function() { const code = document.querySelector('pre code').innerText; navigator.clipboard.writeText(code).then(() => { const toast = document.getElementById('copiedToast'); toast.style.display = 'block'; setTimeout(() => { toast.style.animation = 'fadeOut 2s forwards'; }, 1000); setTimeout(() => { toast.style.display = 'none'; toast.style.animation = ''; }, 3000); }); }); </script> </body> </html>