Percentage values in background-position; - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Percentage values in background-position;

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">
#xyz {<!--from  ww w  .j a va 2s .co m-->
   position:relative;
   height:501px;
   width:751px;
   background-color:Chartreuse;
}

#xyz:after {
   background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   background-repeat:no-repeat;
   position:absolute;
   content:'';
   top:51% ;
   left:26% ;
   right:26% ;
   bottom:26% ;
}
</style> 
 </head> 
 <body> 
  <div id="xyz"></div>  
 </body>
</html>

Related Tutorials