第二个div不比第一个div宽

时间:2017-01-30 09:13:26

标签: html css

我有这个布局:https://postimg.org/image/74ioib3y7/

游戏规则是:

  1. 容器必须至少210px宽,85px高
  2. Row1应该能够根据需要增长,并且仅当容器与容器一样大时才包装单词
  3. Row2必须与Row1 =>一样宽。当Row2的内容比Row1的内容
  4. 更宽时,它应该包装单词而不是拉伸容器

    我设法做了除了3之外的所有事情。

    编辑:JSFiddle

    - (NSString * _Nonnull)stringForValue:(double)value axis:(ChartAxisBase * _Nullable)axis
    {
        NSString *xAxisStringValue = @"";
        int myInt = (int)value;
    
        if(xValsDietArray.count > myInt)
            xAxisStringValue = [xValsDietArray objectAtIndex:myInt];
    
        return xAxisStringValue;
    }
    

    请帮忙

1 个答案:

答案 0 :(得分:1)

这可以解决您的要求:



.container {
  display: inline-block;
  background: aliceblue;
  min-width: 210px;
  min-height: 85px;
  position: relative;
}

.maxim {
   position: absolute;
   width: 100%;
   max-width: 100%;
   background-color: lime;
}

<div class="container">
    <header>
        <strong>12345620</strong>
        <span>description</span>   
    </header>
    <span class="maxim">
        Lorem ipsum  Lorem ipsum  Lorem ipsum  Lorem ipsum  oposum
    </span>    
</div>    
        
<div class="container">
    <header>
        <strong>1234567890</strong>
        <span>description and more text is here also possible</span>   
    </header>
    <span class="maxim">
        Lorem ipsum  Lorem ipsum  Lorem ipsum  Lorem ipsum  oposum
    </span>    
</div> 
&#13;
&#13;
&#13;