grazi Xinod...

ho fatto così...

codice:
<script type="text/javascript">
function idealWidth()
{
var ul=document.getElementById('lista');
var lis=ul.getElementsByTagName('li');
var w=0;
for(var k=0,l=lis.length;k<l;++k){
  w+=lis[k].offsetWidth;
}
ul.style.width=w+'px';
}
</script>
com'è meglio richiamarla, all'onload?

<body onload="idealWidth()">