0

私はシンプルなコンテンツ管理システムを作成しています.CSSとレイアウトは、フッターセクションを移動してその上のラッパーセクションに移動するテーブルを作成する以外はすべて機能します. テーブルの下のテキストでも、テーブルの上に出力されます。

私の基本的なレイアウト...

        <?php
        session_start();
        //nav bar //top part of page which fully works etc
        include "header.php";
    ?>

    <section class= "mainSection">

    <section class = "subMain">
    <p> this should be above </p>

    <?php include "/mysql/catgoryShow.php"; ?>

    <p> this should be below the table </p>

    </section>

    </section>
    <footer class = "mainFooter">

    </footer>

</body>

CSSの私の重要な部分...

section.mainSection{

margin-left: 4%;
margin-right:4%;
min-height: 1000px;
background-color: #ffffff;

border-left-style:solid;
border-left-color:#DAE3ED;
border-left-width:5px;

border-right-style:solid;
border-right-color:#DAE3ED;
border-right-width:5px;



   }

section.subMain{
margin-left: 10%;
margin-right: 10%;
padding-top:10%;
padding-bottom: 2%;

 }

私のフッターCSS

footer.mainFooter{

margin-left: 4%;
margin-right:4%;
height: 75px;
background-color:#78B0F0;
border-top-style:solid;
border-top-color:#DAE3ED;
border-top-width:5px;
 }

そして最後に私のテーブル

    <?php
$result=mysql_query($query);

$num=mysql_numrows($result);
    echo "<p>'$query' returns $num rows:<p>\r\n";
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td><font face="Arial, Helvetica, sans-serif">|Product ID|</font></td>
<td><font face="Arial, Helvetica, sans-serif">|Product Name|</font></td>
<td><font face="Arial, Helvetica, sans-serif">Product Category|</font></td>
<td><font face="Arial, Helvetica, sans-serif">Product Minimum Age|</font></td>
<td><font face="Arial, Helvetica, sans-serif">Product Discription|</font></td>
<td><font face="Arial, Helvetica, sans-serif">Product Price|</font></td>
<td><font face="Arial, Helvetica, sans-serif">Product Quantily Available|</font></td>
<td><font face="Arial, Helvetica, sans-serif">View Product Page|</font></td>
</tr>

<?php
$i=0;
while ($i < $num) {

$f1=mysql_result($result,$i,"ProductID");
$f2=mysql_result($result,$i,"ProductName");
$f3=mysql_result($result,$i,"ProductCategory");
$f4=mysql_result($result,$i,"SuitableAge");
$f5=mysql_result($result,$i,"ProductDiscription");
$f6=mysql_result($result,$i,"ProductPrice");
$f7=mysql_result($result,$i,"ProductAvailable");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="../cw/itemPage.php?id=<?php echo $f1?>">View Details</a></font></td>
</tr>

<?php

$i++;
}
   echo "<p>'$query' returns $num rows:<p>\r\n";


?>

クエリを示す両方のエコーが、何らかの形でテーブルの前に出力されます:/

4

3 に答える 3

2

</table>前に述べたように、適切なタグでそのテーブル要素を閉じる必要があります。まれに、テーブルがいくつかの浮動小数点値を継承している可能性があるため、footer.mainFooter { clear: both; }修正する必要があります。

于 2012-12-31T13:49:19.633 に答える
1

@cimmanonが指摘したように、この<table>タグを閉じることは本当に良いスタートになるでしょう

于 2012-12-31T13:42:43.457 に答える
0

メイン フッターの css には、 と を追加position:relativebottom:0ます。常に下に固定されます。

于 2012-12-31T13:41:26.033 に答える