tags:

views:

20

answers:

1

Hi. Currently im having this for displaying my statusmessages:

<?php
while($showSe = mysql_fetch_array($stringUSS)) { ?>

    <strong style="font-size: 12px;"><?php get_day_name($showSe["date"]); get_time($showSe["date"]); ?>  </strong><br>
    <span style="font-size: 20px; text-align: center; margin: 10px;"><?php echo $showSe["status"]; ?></span>
    <hr>
<?php } ?>

Now it displays everything from the database order by id. What i want to do now is that the first/newest one, should have font-size: 18px; while the rest have 12px;

+1  A: 

You could use a counter or a flag to indicate the first iteration:

$counter = 0;
while ($showSe = mysql_fetch_array($stringUSS)) {
    $fontSize = ($counter === 0) ? 18 : 12;
?>
<strong style="font-size: <?php echo $fontSize;?>px;"><?php get_day_name($showSe["date"]); get_time($showSe["date"]); ?>  </strong><br>
<span style="font-size: 20px; text-align: center; margin: 10px;"><?php echo $showSe["status"]; ?></span>
<?php
    $counter++;
}

Another way would be to use pure CSS: Put your items in a list (e.g. OL) and use ol > li:first-child > strong to select the STRONG element of the first LI:

ol > li > strong {
    font-size: 12px;
}
ol > li:first-child > strong {
    font-size: 18px;
}
Gumbo
Or you could just do `$fontsize = 18` outside the loop, and then reset it to 12 after the first result row's been output. But then, using the counter would be more flexible if the OP decides multiple 'first' lines need the embigenation treatment.
Marc B