Make a flexbox container surround absolutely-positioned content - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Container

Description

Make a flexbox container surround absolutely-positioned content

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">

.container {<!--  w ww  . ja  v  a 2s .  c om-->
   display: flex;
   justify-content: center;
   margin: 30px;
}
.content {
   background: red;
   flex: auto;
   flex-direction: column;
   min-width: 30em;
   max-width: 38em;
   padding: 10px;
   margin: 5px;
}
.slides {
   position: relative;
   width: 100%;
   height: 200px;
}
.content img {
   max-height: 100%;
   position: absolute;
}


      </style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="content"> 
    <div class="slides"> 
     <img src="https://www.java2s.com/style/demo/Safari.png"> 
     <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
    </div> 
   </div> 
   <div class="content"> 
    <p>This is some content.</p> 
    <p>This is some more content.</p> 
    <p>This is some more content.</p> 
    <p>This is some more content.</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials