HTML CSS automatically adjust height

后端 未结 1 1129
灰色年华
灰色年华 2021-02-15 11:59

I am trying to display outbound and inbound flight by visualising it using CSS/LESS. The problem is that when Outbound flight has more airport changes then Inbound then line sta

相关标签:
1条回答
  • 2021-02-15 12:08

    That just screams flexbox. Support level is already at 94.82%. You will need to use all those ugly prefixes, but you can help yourself with STYLUS/LESS and the rest of 'em.

    Here's a quick outline of what you might end up with:

    .roundtrip {
      display: inline-flex;
      flex-direction: row;
      align-items: stretch;
      background-color: #909090;
    }
    
    .trip {
      width: 100px;
      text-align: center;
      border: 1px solid black;
      margin: 0px 3px;
      display: flex;
      flex-direction: column;
    }
    
    .flight {
      background-color: #B0B0B0;
      white-space: nowrap;
    }
    
    .flight-path {
      width: 6px;
      min-height: 15px;
      flex-grow: 1;
      align-self: center;
      background-color: #6090FF;
    }
    
    .connection {
      height: 40px;
      color: red;
      border: 1px solid red;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    <span class="roundtrip">
      <div class="trip">Outbound
        <div class="flight">Los Angeles</div>
        <div class="flight-path"></div>
        <div class="flight">Chicago</div>
        <div class="connection">5hr wait</div>
        <div class="flight">Chicago</div>
        <div class="flight-path"></div>
        <div class="flight">New York</div>
        <div class="connection">2hr wait</div>
        <div class="flight">New York</div>
        <div class="flight-path"></div>
        <div class="flight">Amsterdam</div>
      </div>
      <div class="trip">Inbound
        <div class="flight">Amsterdam</div>
        <div class="flight-path"></div>
        <div class="flight">Los Angeles</div>
      </div>
    </span>

    0 讨论(0)
提交回复
热议问题