あなたはあなたが全体のメニューのpercentual一部を取得legth特定の文字列で一緒にして、文字列のな長さをカウントすることができ、あなたのページ
を生成しているのlangaugeで、それを扱うことができます。
<?php
// percentageCounter.php
$menuItems = array(
'home'=>array('label'=>'Home'),
'learn'=>array('label'=>'Learn More About The Product',),
'about'=>array('label'=>'About Us',),
'contact'=>array('label'=>'Contact Us',),
'str_len_sum' => 0,
);
foreach($menuItems AS $key => $menuItem)
{
$menuItems['str_len_sum'] += strlen($menuItem['label']);
}
foreach($menuItems AS $key => $menuItem)
{
$menuItems[$key]['percentage'] = (100/$menuItems['str_len_sum'])*strlen($menuItem['label']);
}
とメニュー
<?php //menuOutput.php
require_once 'percentageCounter.php';
?>
<div id="parent">
<?php foreach($menuItems AS $key => $menuItem): ?>
<a href="/<?php echo $key ?>" style="width: <?php echo $menuItem['percentage'] ?>%;"><?php echo $menuItem['label'] ?></a>
<?php endif; ?>
</div>
私はとてもいい人になるように努力していますし、レイアウト用のテーブルを使用していませんが、それは私を噛んでいます! :) – JerSchneid