2015-12-21 89 views
0

我有一个div与其他四个divs里面。更改div大小取决于其他div大小

<div class="content" style="height: 248px"> 
    <div class="info" style="height: 16px">Information</div> 
    <div class="title">Title</div> 
    <div class="excerpt">Excerpt</div> 
    <div class="social" style="bottom: 0; position: absolute; height: 20px">Social</div> 
</div> 

标题div是动态的。如何根据标题高度设置摘录div的高度?我所有的四个div都必须适合248 px的高度。此外,我需要添加text-overflow: ellipsis;以摘录div。

回答

0

我解决我的问题用JavaScript

$(".article_big_content").each(function() { 

    var big_title_height = $(this).children(".article_big_title").outerHeight(); 

    var big_excerpt_container_height = 250 - 16 - 20 - big_title_height; 

    $(this).children(".article_big_text").children("p").css("height", big_excerpt_container_height);}); 

然后我用dotdotdot.js以文本的末尾添加省略号。