开发者

CSS Class around row not working

开发者 https://www.devze.com 2023-04-11 13:39 出处:网络
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\

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:

  1. add the class to your <tr> elements (ex. <tr class="reviews">)
  2. add the class to your <td> elements (ex. <td class="reviews">)
  3. put the <div> element inside the <td>.
  4. something I haven't thought about.
0

精彩评论

暂无评论...
验证码 换一张
取 消