I want to loop replies. In doing so, I want each reply to look nice with its own background and spacing from each other one. In doing so, I placed a div tag around the reply itself, however, it doesn't seem to be working. I tested with a border, and it seems like the borders are staying at the very top of the container instead of putting themselves around the reply. Here's some code
echo "<table>";
while($query3 = mysql_fetch_array($sql2)) {
$revuserid = $query3['userid'];
$review = $query3['review'];
$revtime = $query3['time'];
$revuser = mysql_fetch_assoc(mysql_query("select username, id f开发者_StackOverflowrom users where id='{$revuserid}'"));
$revusername = $revuser['username'];
echo "<div class=reviews><tr><td><a href=viewuser.php?pid=$revuserid>$revusername</td></tr><tr><td>$review</td></tr><tr><td>Date: $revtime</td></tr></div>";
}
echo "</table>";
echo $centerPages;
In HTML, all this is:
<table>
<div class=reviews><tr><td><a href=viewuser.php?pid=$revuserid>$revusername</td></tr><tr><td>$review</td></tr><tr><td>Date: $revtime</td></tr></div>
</table>
notice the class div in the loop.
In css, I have for testing the class.
.reviews {
border: 1px solid black;
}
Thanks!
Don't put your <tr> elements inside a <div> element. That is not acceptable to HTML. Do one of the following:
- add the class to your <tr> elements (ex.
<tr class="reviews">
) - add the class to your <td> elements (ex.
<td class="reviews">
) - put the <div> element inside the <td>.
- something I haven't thought about.
精彩评论