-1

我的代码:


使用以下代码实现:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>

<?php
echo '<table><tr>';
$folders = @scandir('Users');  
     foreach($folders as $item):
     if ((substr($item, 0, 1) == '.') || (preg_match("/\.php$/", $item)))
                continue;
    ?>
    <td>
          <table width="220" border="1" valign="top">
               <tr><th width="210" valign="top"><?php echo $item;?></th></tr>
              <?php
               if (is_dir("Users/$item"))
            $target_folders = @scandir("Users/$item/uploaded/");
                foreach($target_folders as $target_item){

                if ((!preg_match("/^[.]/",$target_item)) || (!is_dir("Users/$item/uploaded/$target_item"))){
                if ((substr($target_item, 0, 1) == '.'))
                   continue;     

                   ?><tr><td><?php echo $target_item ;?></td></tr><?php

                }
                }

                   ?>
          </table>
</td>
    <?php
endforeach;

echo '</tr></table>';
?>



</body>
</html>

现在,对于我的生活,我无法获得与页面顶部对齐的数据。我真的不知道我在这里做错了什么,但我知道这可能很简单。

我正在显示的链接: 当前代码结果

4

3 回答 3

1

在样式表中添加关注

td {
    vertical-align: top;
}

问候

于 2013-09-26T13:28:21.060 回答
0

尝试将 td 对齐为 top 而不是 table valign - top

于 2013-09-26T13:20:28.157 回答
0

发布,因为我还是写了,然后你改变了问题内容

  1. 呈现一个带有实际呈现的 html 的 jfiddle.net

  2. 解释你为什么使用如此复杂的文档类型

  3. 尝试

http://jsfiddle.net/mplungjan/kG7B4/

td { vertical-align:top } 
于 2013-09-26T13:23:30.820 回答