CSS ul li if remove 1 make others bigger -


the height of ul 500px. how can make li height dynamic number of li there are? example, if have 5 li, height 20%, if 4 li, changes 25%.

here tried, if remove 1 element "developer mode", height doesn't change.

ul{     list-style:none;     height:500px;     width:100%;     overflow:hidden; } li{     width:100px;     height:25%;     background:red;     border:1px solid black; } 

http://jsfiddle.net/crcb8/

enter image description here

a little jquery need, , supported majority of browsers , mobile devices

$(document).ready(function () {      var x = $('li').siblings().length;      var y = 100/x;      $('li').css('height', y + '%'); }); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -