Css positioned element offscreen - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Css positioned element offscreen

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">
#maincontent {<!-- w  ww  .ja  va  2s.c o  m-->
   position:absolute;
   width:100px;
   height:251px;
   top:100px;
   background-color:Chartreuse;
}

#maincontent2 {
   position:absolute;
   width:100px;
   height:251px;
   background-color:yellow;
   top:-100px
}

body {
   position:relative;
}
</style> 
 </head> 
 <body> 
  <div id="maincontent"></div> 
  <div id="maincontent2"></div>  
 </body>
</html>

Related Tutorials