Reputation:
So I have a "post" system and I want the box to get larger as more posts come in. Here's what I see
This is what happens as I add another post
I just want it to keep adding height as more posts get posted. Here's what I'm currently using
<div class="comment">
<div class="comment_cont">
<div class="icons">
<i class="fa fa-heart"></i>
<i class="fa fa-comment"></i>
</div>
<h1 class="message">@alex likes cats</h1>
<p class="time">4 minutes ago</p>
</div>
<div class="comment_cont">
<div class="icons">
<i class="fa fa-heart"></i>
<i class="fa fa-comment"></i>
</div>
<h1 class="message">@alex likes cats</h1>
<p class="time">4 minutes ago</p>
</div>
</div>
And my CSS
*{
padding: 0;
margin: 0 auto;
}
html{
height: 100%;
}
body{
background: #F6F5F6;
height: 100%;
}
.follow{
font-size: 23px;
font-family: 'Avenir Next';
font-weight: 500;
display: inline-block;
margin-right: -62%
}
.likes{
padding-left: 20px;
}
.message{
font-family: 'Avenir Next';
font-weight: 400;
padding-left: 35px;
line-height: 70px;
}
.post{
width: 100%;
height: 100px;
border-bottom: 1px solid #ccc;
}
.fa-heart{
transition: 0.5s;
margin-top: 60px;
color: #000;
font-size: 24px;
float: right;
margin-right: 30px;
cursor: pointer;
}
.fa-heart:hover{
transition: 0.5s;
margin-top: 60px;
color: #FF6699;
font-size: 24px;
float: right;
margin-right: 30px;
cursor: pointer;
}
.fa-comment{
transition: 0.5s;
margin-top: 60px;
color: #000;
font-size: 24px;
float: right;
margin-right: 18px;
cursor: pointer;
}
.fa-comment:hover{
transition: 0.5s;
margin-top: 60px;
color: #FF6699;
font-size: 24px;
float: right;
margin-right: 18px;
cursor: pointer;
}
.icons{
float: right;
margin-right: 0px;
}
.time{
font-family: 'Avenir Next';
padding-left: 40px;
color: #929292;
padding-bottom: 20px;
border-bottom: 1px solid #ccc;
}
.comment{
border-radius: 15px;
margin-top: 150px;
width: 750px;
height: 200px;
background: #fff;
border: 1px solid #ccc;
}
Here's a demo
Upvotes: 1
Views: 2018
Reputation: 1005
Just an add on to Issam's post. You don't really need to specify a height. Since you'll dynamically adding it with the comments. So
.comment{
border-radius: 15px;
margin-top: 150px;
width: 750px;
background: #fff;
border: 1px solid #ccc;
}
Would work fine as well
Upvotes: 1
Reputation: 2774
Just use min-height instead of height
.comment{
border-radius: 15px;
margin-top: 150px;
width: 750px;
min-height: 200px;
background: #fff;
border: 1px solid #ccc;
}
Upvotes: 1