Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  
  <style>
    #a{
      background-color: grey;
      padding:5px;
      display:inline-block;
    }
    
    #b{
      width: 100px !important;
      background-color: orange;
      line-height: 15px;
      padding:5px;
    }
    
    #b.big{
      width: 200px !important;
    }
    
    #h{
      background-color: yellow;
      line-height: 15px;
      padding:5px;
    }
  </style>
  
  
  <div id="a">
    <div id="h">please make me wrap without setting my width or setting the outer divs width</div>
    <div id="b">this div decides how the other divs should wrap
    </div>
  </div>
  
  <br/>
  <h3>this should work as well without changing styles for grey and yellow:</h3>
  
    <div id="a">
    <div id="h">please make me wrap without setting my width or setting the outer divs width</div>
    <div id="b" class="big">this div decides how the other divs should wrap
    </div>
  </div>
  
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers