Make Img inside Flexbox responsive - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Responsive

Description

Make Img inside Flexbox responsive

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

html, body {
   height: 100%;
   margin: 0;
}
.container {<!--from  w  w w. ja  va 2 s .com-->
   width: 100%;
   height: 100%;
   background: black;
   position: relative;
}
.item {
   max-width: 100%;
   max-height: 100%;
   position: absolute;
   left: 50%;
   top: 50%;
   transform: translate(-50%, -50%);
}


      </style> 
 </head> 
 <body> 
  <div class="container"> 
   <img src="https://www.java2s.com/style/demo/InternetExplorer.png" class="item"> 
  </div> 
 </body>
</html>

Related Tutorials