도토루

최신글,게시판등의 리스트 배경색 다르게 나타내기

<style>
.list0 {background-color:#EEF3F6; height:28px; font-size:9pt;}
.list1 {background-color:#F7FAFB; height:28px; font-size:9pt;}
</style>

<table width=97% cellpadding=0 cellspacing=0>
<!-- 목록 -->
<?$coloring=0;?>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr height=28 align=center class='list<?=$coloring%2?>'>
<td colspan="<?=$colspan?>" >내용 </td>
</tr>
<?$coloring++?>
<tr>
<td colspan="<?=$colspan?>" height="1" bgcolor="#EEEEEE"></td>
</tr>
<?}?>

<? if (count($list) == 0) { ?>
<tr>
<td colspan='$colspan' height=30 align=center>게시물이 없습니다.</td>
</tr><? } ?>
</table>

아시는 분들이 더 많으시겠습니다만, 초보참고용으로 적습니다.
리스트가 증가될수록 순차적으로 리스트배경색이 다르게 나옵니다.
|

댓글 2개

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고