- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a responsive image with CSS?
Following is the code to create a responsive image with CSS −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> img { width: 100%; max-width: 1000px; } </style> </head> <body> <h1>Responsive Images Example</h1> <h2>Resize the window to see responsive image scale up and down</h2> <img src="https://images.pexels.com/photos/34950/pexels-photo.jpg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"> </body> </html>
Output
The above code will produce the following output −
On resizing the browser the image will scale down as follows −
- Related Articles
- How to create a responsive image gallery with CSS
- How to create a responsive Image Grid with HTML and CSS?
- How to create a responsive header with CSS?
- How to create a responsive form with CSS?
- How to create a responsive table with CSS?
- How to create a responsive "timeline" with CSS?
- How to create responsive typography with CSS?
- How to create responsive testimonials with CSS?
- How to create a responsive login form with CSS?
- How to create a responsive checkout form with CSS?
- How to create a responsive inline form with CSS?
- How to create a responsive pricing table with CSS?
- How to create a responsive blog layout with CSS?
- Create a responsive pagination with CSS
- How to create responsive floating elements with CSS?

Advertisements