</> Code Corner

CSS · CSS Responsive · Lesson 65

RWD Intro

Responsive Web Design basics.

Responsive web design makes your web page look good on all devices. It uses only HTML and CSS — no special program or JavaScript.

  • Set the viewport meta tag
  • Use fluid widths (%, fr, max-width) instead of fixed pixels
  • Make images flexible with max-width: 100%
  • Use media queries to adapt the layout at breakpoints
  • Design mobile-first

Example

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.cards div { background: #04AA6D; color: white; padding: 30px; border-radius: 8px; text-align: center; }
img { max-width: 100%; height: auto; }
</style>
<div class="cards"><div>One</div><div>Two</div><div>Three</div><div>Four</div></div>

Keep reading “RWD Intro”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋