How do you make a web page responsive using HTML and CSS?

Do these four things.

  • Add the viewport meta tag in the head.
  • Make images flexible with max-width: 100%; height: auto;.
  • Use relative units like % and rem, not fixed pixels.
  • Use media queries to change the layout on small screens.
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>
  img { max-width: 100%; height: auto; }
  .column { width: 50%; float: left; }
  @media (max-width: 600px) {
    .column { width: 100%; float: none; }
  }
</style>

See HTML Responsive Design.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.