codegurukool.com · Free coding tutorials & online compiler

Home › HTML Tutorial › HTML responsive

HTML responsive

Pages that fit every screen.

Add the viewport meta tag, use max-width:100% on images and media queries or flexible layouts for the rest.

Example code

<style>img{max-width:100%;height:auto}.row{display:flex;flex-wrap:wrap;gap:8px}.row div{flex:1 1 140px;background:#2e86de;color:#fff;padding:12px}</style>
<div class='row'><div>One</div><div>Two</div><div>Three</div></div>'

Run this code in the online editor

← HTML layoutComputer code elements →