Search code examples
htmlcsstextword-wrap

CSS forced wrap


In the first picture, the circled areas are two inline-block div elements. Currently when i make the browser window smaller the second div element jumps under the first one as expected. What i want is to make the text inside the second div element to wrap when i make the window smaller and to keep the space under the first div element empty.

big window

small window


Solution

  • Thank for your answers. Finally i got the result i wanted with this:

    <div id="big">
      <div id="left">
        <div>#15</div>
        <div>OPEN</div>
      </div>
      <div id="right">
        <p>TODO: add a destination for Hello, User hyperlink</p>
      </div>
    </div>
    
    <style>
    #big {
      display: flex;
    }
    
    #left {
      flex-shrink: 0;
      width:100px;
      display: flex;
      flex-direction: column;
    }
    
    div, p {
        margin:0;
    }
    </style>