Making an image responsive using css

the following css will make an image display 100% its size and keep its aspect ratio if the screen size or element size gets smaller than the containing image. you should be able to drag the edge of the image to resize and see how it responds.


<div class='resizeable'><img class='responsive' src=''></div>


img.responsive {
	max-width: 100%;
	display: block;
	height: auto;
.resizeable {
	height: 400px;
  	width: 300px;
	resize: horizontal;
    overflow: auto;
    border: 1px solid #000;

Other Items in css
Page Views

This page has been viewed 333 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
There is a qualitative and quantitative difference between a day that begins with a little exercise, a book, meditation, a good meal, a thoughtful walk, and the start of a day that begins with a smartphone in bed.