HTML CSS examples for CSS Layout:Responsive Layout
create a responsive div with img in it
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> html, body { width:100%; height:100%; margin:0; } img {<!-- w w w . j ava 2s . c om--> max-width:601px; max-height:301px; height:auto; width:100%; padding:6px; background:Chartreuse; } </style> </head> <body> <img id="pic" src="https://www.java2s.com/style/demo/Opera.png"> </body> </html>