viewport meta
Tells mobile browsers how to size the page.
Learn HTML Responsive as the bridge between clean HTML and professional CSS: visual hierarchy, maintainable styling, responsive behavior and live practice.
HTML styling foundation
Responsive design means the page adapts to different screen sizes, input types and reading situations. HTML provides the right viewport and flexible content. CSS handles fluid sizing, layout changes and media queries.
Beginners often think responsive design starts with many breakpoints. It starts earlier: readable HTML, flexible containers, images that can shrink and CSS that does not lock everything into fixed desktop widths.
A high-end page should not only look good at 1920px. It should still feel intentional on a laptop, tablet and phone.
Tells mobile browsers how to size the page.
Use max-width, min(), clamp() and percentages instead of fixed-only layouts.
Change layout at useful breakpoints.
Images, text and buttons should fit without overlap.
Syntax and structure
The viewport meta tag belongs in HTML. Fluid layout and media queries belong in CSS.
<meta name="viewport" content="width=device-width, initial-scale=1">
<section class="feature-grid">
<article>HTML</article>
<article>CSS</article>
<article>JavaScript</article>
</section>
<style>
.feature-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;
}
@media (max-width: 720px) {
.feature-grid { grid-template-columns: 1fr; }
}
</style>
<div style="width: 1200px;"> <img src="hero.jpg" width="1200"> <p style="font-size: 48px;">This text will not fit on small screens.</p> </div>
Rules that matter
Styling is not only making something look nice once. Good CSS stays readable, reusable and predictable while the project grows.
Without viewport metadata, mobile browsers may render the page as a zoomed-out desktop layout.
Use max-width and flexible grids before adding many breakpoints.
Text can wrap, translate and grow. Let containers adapt.
Fluid type is useful when it has sensible minimum and maximum sizes.
Check common desktop, laptop, tablet and mobile widths.
Responsive design fails when text, buttons or images collide.
Production thinking
This matters because users do not visit from one perfect screen. Responsive CSS is the difference between a design that only looks good in your editor and a website that survives real life.
Responsive design helps zoom users and mobile users. Text should reflow without horizontal scrolling, and controls should remain usable by touch and keyboard.
Treat responsive checks as part of QA. A site is not finished because it looks good on the designer or developer screen.
Mobile usability and performance matter for search quality. Responsive pages also reduce duplicate desktop/mobile URLs.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.