dynamische td width
Thorsten F.
- php
0 Madness Phil0 Zwomble
Hallo,
habe eine Tabelle mit 3 Spalten. Die width zweiten Spalte soll abhängig sein, von dem darin enthaltenten Wert. Es soll aso ein roter Balken dargestellt werden.
Allerdings macht er mir die Balken alle gleich groß.
Wenn ich das allerdings ohne table mache, also nur mit dem div-tag, dann fuktioniert das wunderbar.
Wieso nicht in einer table?
<table align="center" border=1>
<tr>
<td>
<?php echo $x1; ?>
</td>
<td
<div style="width:<?php echo $y1; ?>px;height:10px;background-color:red;"></div>
</td>
<td>
<?php echo $y1 ." €"; ?>
</td>
</tr>
<tr>
<td>
<?php echo $x2; ?>
</td>
<td
<div style="width:<?php echo $y2; ?>px;height:10px;background-color:red;"></div>
</td>
<td>
<?php echo $y2 ." €"; ?>
</td>
</tr>
<tr>
<td>
<?php echo $x3; ?>
</td>
<td
<div style="width:<?php echo $y3; ?>px;height:10px;background-color:red;"></div>
</td>
<td>
<?php echo $y3 ." €"; ?>
</td>
</tr>
<tr>
<td>
<?php echo $x4; ?>
</td>
<td
<div style="width:<?php echo $y4; ?>px;height:10px;background-color:red;"></div>
</td>
<td>
<?php echo $y4 ." €"; ?>
</td>
</tr>
</table>
Hi,
wenn Du es Dir im Browser anschaust, sind die Werte denn dann richtig - MR Quelltext anzeigen?
Phil
<td
<div style="width:<?php echo $y1; ?>px;height:10px;background-color:red;"></div>
</td>
mach erstmal das td zu!
Zwomble
mach erstmal das td zu!
Zwomble
Huppala, na sowas! Habe ich jetzt gara nicht gemerkt. Hat sofort funktioniert. Naja, da war ich wohl etwas zu schnell. Habe zwar des öfteren über den Quell-Code geschaut, aber das habe ich natürlich immer übersehen.
THX.
lol