Width:auto for absolutely positioned div when scroll bar is present - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

Width:auto for absolutely positioned div when scroll bar is present

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
#main {<!--from w w  w .  ja  va  2s  .c  o  m-->
   height:100px;
   border:2px solid Chartreuse;
   overflow-y:scroll;
   position:absolute;
   padding-right:11px;
}
</style> 
 </head> 
 <body translate="no"> 
  <div id="main"> 
   <div id="a">
     Lorem 
   </div> 
   <div id="a">
     Lorem 
   </div> 
   <div id="a">
     Lorem ipsum dolo 
   </div> 
   <div id="a">
     Lorem 
   </div> 
   <div id="a">
     Lorem 
   </div> 
   <div id="a">
     Lorem 
   </div> 
   <div id="a">
     Lorem 
   </div> 
   <div id="a">
     Lorem 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials