Aligning fullscreen image divs on horizontal scrolling page - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Align

Description

Aligning fullscreen image divs on horizontal scrolling page

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,<!-- w  ww.  j a  v  a2s .c o m-->
body {
   width:100%;
   height:100%;
   margin:0;
   padding:0;
}

#wrapper {
   width:100%;
   height:100%;
   margin:0;
   padding:0;
   white-space:nowrap;
   overflow-x:scroll;
}

.a,
.b {
   width:100%;
   height:100%;
   vertical-align:top;
   background-size:contain;
   background-repeat:no-repeat;
   display:inline-block;
}

.a {
   background-image:url('http://www.java2s.com/style/demo/Google-Chrome.png');
}

.b {
   background-image:url('http://www.java2s.com/style/demo/Google-Chrome.png');
}
</style> 
 </head> 
 <body> 
  <div id="wrapper"> 
   <div class="a">
     Text 
   </div> 
   <div class="b">
     Text 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials