Flexbox项目突破容器

Osc*_*son 0 html css layout flexbox

没有调整我的显示器大小我的布局看起来像这样(这是非常正确的)

在此输入图像描述

但是,当我调整大小时,金额会突破容器

在此输入图像描述

我希望绿色区域,正文,随着文本变长或屏幕调整大小而不断缩小.我不希望任何其他东西调整大小,尤其是.不希望它突破容器.绿色区域有足够的空间来调整大小.

这是我的演示http://jsbin.com/potalu/1/edit的链接

如果你想在这里查看CSS:

.clear { clear: both; }
.transaction {
  background:#ccc;
  display:flex;
  align-content: flex-center;
  align-items: center;
  position:relative;
  width:100%;
}
  .checkbox {
    background: lighten(red, 40%);
    width: 30px;
   }
    .checkbox .box {
      width: 10px;
      height:10p;
      border: 1px solid orange;
    }
  .date {
    background: lighten(blue, 30%);
    width: 25px;
  }
  .description {
    background: lighten(green, 60%);
    padding-right: 10px;
    flex-grow: 2;
  }
    .description-wrapper { 
      white-space:nowrap;
      overflow: hidden;
      text-overflow: ellipsis; 

    }
  .amount {
    background: lighten(purple, 60%);
  }
  .txn-amount {
    width: 100%;
    text-align:right;
  }
Run Code Online (Sandbox Code Playgroud)

Pow*_*tch 6

只需添加:

flex-shrink: 0;
Run Code Online (Sandbox Code Playgroud)

到你不想收缩的所有区域(.checkbox,.日期,.amount)并将.description设置为

flex-shrink: 1;
Run Code Online (Sandbox Code Playgroud)

请参阅:http://jsbin.com/qolajanetesi/1/edit?css