How to make responsive website section using html & css | Hero Section | 2

        Hello guys. Welcome to my notes. If you want to see the steps making this tutorial, you can directly watch the video below.  and If you want the code from the tutorial, just scroll down.


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="style.css" /> <title>Hero Section</title> </head> <body> <section class="hero"> <div class="left"> <h3 class="head_text">Unleash Your Inner Chess Grandmaster</h3> <p class="body_text"> Discover the secrets of the chessboard, sharpen your tactics, and become a true chess grandmaster. Start your chess adventure now. </p> <a href="#" class="link">Learn more</a> </div> <div class="right"> <div class="img_container"> <img src="src/chess.jpg" alt="" class="img" /> </div> </div> </section> </body> </html>


@import url(';500;700;900&display=swap'); *{ margin: 0; padding: 0; box-sizing: border-box; text-decoration: none; font-family: 'Roboto', sans-serif; } .hero{ max-width: 1280px; width: 100%; margin: 0 auto; display: flex; align-items: center; padding: 48px 48px; gap: 12px; } .left{ flex: 1; } .head_text{ color: #333; font-size: 56px; font-weight: 700; } .body_text{ color: #707070; font-size: 24px; margin: 16px 0 24px; } .link{ color: #000; font-size: 20px; font-weight: 600; } .link:hover{ text-decoration: underline; } .right{ flex: 1; padding: 12px; } .img_container{ width: 100%; aspect-ratio: 3/4; border-radius: 24px; overflow: hidden; } .img{ width: 100%; height: 100%; object-fit: cover; object-position: center; } @media screen and (max-width:980px){ .hero{ flex-direction: column-reverse; padding: 48px 24px; gap: 24px; } .head_text{ font-size: 48px; } .body_text{ font-size: 22px; } .link{ font-size: 18px; } .right{ padding: 0; } }

or you can get full code in by clicking button bellow :

Download Code

Buy Me A Coffee

Thank You for coming to my notes, if you wanna see another tutorial , you can check to my notes or you can subscribe to my Youtube channel , where I post new tips&tricks and tutorials about HTML, CSS and Javascript. See You !!!

Post a Comment