Auto resizing div with max width - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Width

Description

Auto resizing div with max width

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">
.balloon {<!--  ww  w.  ja  v  a 2  s  .  com-->
   background:Chartreuse;
   border:solid 3px;
   display:inline-block;
   max-width:226px;
}
</style> 
 </head> 
 <body> 
  <div class="balloon">
    This is sample text. This is a seco sentence. 
  </div> 
  <div class="balloon">
    This is sample text. 
  </div>  
 </body>
</html>

Related Tutorials