Agyan
adda
Run
Reset
Copy
CSS Tutorial › CSS Responsive Design › Responsive hero section
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<style> * { box-sizing: border-box; } .hero { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 20px; background: #f0f6ff; border-radius: 10px; } .hero .text { flex: 1 1 260px; } .hero h1 { font-size: clamp(1.5rem, 5vw, 2.8rem); color: #1f386b; margin: 0 0 8px; } .hero .img { flex: 1 1 200px; height: 160px; background: linear-gradient(135deg, #4a90e2, #1f386b); border-radius: 10px; } .btn { display: inline-block; background: #e8590c; color: white; padding: 10px 20px; border-radius: 6px; text-decoration: none; } </style> <section class="hero"> <div class="text"> <h1>Learn CSS Today</h1> <p>Free lessons with live examples.</p> <a class="btn" href="#">Start now</a> </div> <div class="img"></div> </section>
Result