Resize image with page resizing - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image

Description

Resize image with page resizing

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">
* {<!-- w  ww . j  a  v  a2s  .  c o  m-->
   padding:0;
   margin:0:
}

.wrapper {
   position:relative;
   width:100%;
}

.background {
   width:100%;
}

.background img {
   width:100%;
   height:auto;
}

.title {
   position:absolute;
   top:51%;
   left:51%;
   transform:translate( -51%, -51% );
   color:Chartreuse;
   font-size:26px;
   white-space:nowrap
}
</style> 
 </head> 
 <body> 
  <div class="wrapper"> 
   <div class="background"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
   </div> 
   <div class="title">
     Lorem Ipsum Dolor 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials