【问题标题】:Diplaying Thumbnails Next to Each other rather than below MYSQL/PHP彼此相邻显示缩略图而不是在 MYSQL/PHP 下方
【发布时间】:2014-06-08 08:39:02
【问题描述】:

早上,

我正在创建一个个人资料页面,我希望在其旁边显示缩略图,并在单击按钮时弹出带有信息的叠加层。除了缩略图显示在单独的行中之外,我可以让一切正常工作,而我希望它们并排显示。

如果没有叠加层的代码,它们会彼此相邻显示,但叠加层不起作用。目前处于catch22中...

任何指针?

谢谢

<?php
  $result = mysql_query("SELECT * FROM People ORDER BY Position,Number");
  while($row = mysql_fetch_assoc($result)){
      echo '<div class="box" ><div id="triggers">',
           '<img src="profile/'.$row['Id'].'.jpg" rel="#mies'.$row['Id'].'"/>',
           '</div>',
           '<div class="simple_overlay" id="mies'.$row['Id'].'" align="center">',
           '<div class="details">',
           '<img src="profile/'.$row['Id'].'l.jpg" />',
           'Name: <b>'.$row['FirstName'].' '.$row['Surname'].'</b></br>',
           'Position: <b>'.$row['Position'].'</b> Number: <b>'.$row['Number'].'</b></br>',
           'Years With Saxons: <b>'.$row['YrsWithSaxons'].'</b></br>',
           'Previous Teams: <b>'.$row['PreviousTeams'].'</b></br>',
           'Favourite NFL Team: <b>'.$row['NFLTeam'].'</b></br>',
           'Favourite NCAA Team: <b>'.$row['NCAATeam'].'</b></br>',

           '</div></div>';
    }
?>

【问题讨论】:

  • 我认为这与 PHP 或 MySQL 无关。问题在于你的 HTML 和 CSS。
  • 你应该发布 HTML 输出和 CSS,因为 ass @KemalFadillah 提到问题不在于 PHP/MySQL

标签: html css


【解决方案1】:

您可能会在 CSS 中为“box”元素添加一些样式。 添加“浮动:左;”可能还有一个“margin-right: 10px;”,如果你愿意,可以把它们分开一点。 请务必在您的 html 中的最后一个框之后包含 &lt;div style="clear:both"&gt;&lt;/div&gt;

【讨论】:

    【解决方案2】:

    您想要浮动 .box 元素,或者将它们设置为显示为 inline-block。

    display: inline-block;
    

    float: left;
    

    【讨论】:

      猜你喜欢
      • 2021-08-04
      • 1970-01-01
      • 1970-01-01
      • 2021-05-17
      • 2021-04-14
      • 1970-01-01
      • 1970-01-01
      • 2015-03-21
      • 2017-07-13
      相关资源
      最近更新 更多