Q:

Calculate List Height By adding new listitems to the list

Assume : I have a List call Category(height is 300px).  There are already 5 Items on it.  
So i need is, if i add another category item through backend, that new item should auto set to new height. ( See the example to clear bit more)
Example : I have 5 category item.  And List height is 300px.  So this case each list item will set height as (300/5) 60px.  If i add new category item then height should be set to (300/6) 50px. 
list
<div class="categories">
  <ul>
    <h3>Categories</h3>
      <? php
      foreach ($cat as $new_cat){
       ? >
          <li class="cat_list"><a href="#"><?php echo $new_cat['cat_item'];?></a></li>
      <? php
      }
      ? >

  </ul>
</div>

Css
  .categories{
    border:1px solid #EEE;
    height: 434px;
    max-height: 434px;
}
.categories h3{
    font-size:1.2em;
    color:#FFF;
    padding:10px;
    background:#B81D22;
    text-transform:uppercase;
    font-family: 'ambleregular';    
}
.categories li a{
    display:block;
    font-size:0.8em;
    padding:8px 15px;
    color: #9C9C9C;
    font-family: 'ambleregular';
    margin:0 20px;
    background:url(../images/drop_arrow.png) no-repeat 0;
    border-bottom: 1px solid #EEE;
    text-transform:uppercase;   
}
.categories li:last-child a{
    border:none;
}
.categories li a:hover{
    color:#B81D22;
}

how can i mange this?? 

A:

You can achieve this by jquery
Html
<ul class="list">
    <li>One</li>
    <li>Two</li>
    <li>Three</li>
</ul>

Css
.list {
    height:500px;
    border:1px solid red;
}

Script
var listCount = $(".list").find("li").length;
var listHeight = $(".list").height();
$(".list li").height(listHeight / listCount);

Fiddle Demo

