2017-12-07 28 views
1

小さな問題があります。私は動的なテキストでいっぱいの2つの列を持っています。どちらも大きなものによると同じ高さです。さて、大きなdivの内容の後に別の固定divが必要です。私のhtmlコードは次のとおりです。別の子div内の下位固定子div div

.parent { 
 
    display: inline-flex; 
 
    width: 100%; 
 
} 
 

 
.child1 { 
 
    display: inline-block; 
 
    background-color: #c5e997; 
 
    width: 49%; 
 
    position: relative; 
 
} 
 

 
.child2 { 
 
    display: flex; 
 
    position: absolute; 
 
    bottom: 0; 
 
}
<div class="parent"> 
 

 
    <div class="child1"> 
 
    Random text here Less dynamic text 
 
    <div class="child2"> 
 
     Fixed 
 
    </div> 
 
    </div> 
 

 
    <div class="child1"> 
 
    Random text here<br/> More 
 
    <br/> Dynamic 
 
    <br/> Text 
 
    <br/> Here 
 
    <div class="child2"> 
 
     Fixed 
 
    </div> 
 
    </div> 
 

 
</div>

ので、高いダイナミックテキストの後の第2のdivを設定するために、どのように任意のアイデア? この時点で、「固定」テキストが最も長いテキストにわたって表示されます。

L.E:ここにコードが表示されます。https://jsfiddle.net/fte087p7/ ありがとうございます! .child1padding-bottomの追加について

+0

絶対に配置された要素は、親の一番下に 'position:relative'があります。大丈夫です、どこに問題がありますか?相対的な/絶対的な仕事の位置を学ぶ。 – panther

答えて

0

.parent { 
 
    display: inline-flex; 
 
    width: 100%; 
 
} 
 

 
.child1 { 
 
    display: inline-block; 
 
    background-color: #c5e997; 
 
    width: 49%; 
 
    position: relative; 
 
    padding-bottom: 20px; 
 
} 
 

 
.child2 { 
 
    display: flex; 
 
    position: absolute; 
 
    bottom: 0; 
 
}
<div class="parent"> 
 

 
    <div class="child1"> 
 
    Random text here Less dynamic text 
 
    <div class="child2"> 
 
     Text 
 
    </div> 
 
    </div> 
 

 
    <div class="child1"> 
 
    Random text here 
 
    <br/> More 
 
    <br/> Dynamic 
 
    <br/> Text 
 
    <br/> Here 
 
    <div class="child2"> 
 
     Fixed 
 
    </div> 
 
    </div> 
 

 
</div>

どのように?