将注释框设置为在动态生成的注释下方显示

时间:2010-04-05 19:51:29

标签: css

对于下面的代码,我怎样才能使表单始终显示在用“commentecho”设置样式的HTML表格底部30像素的位置?

提前致谢,

约翰

$sqlStr = "SELECT comment.comment, comment.datecommented, login.username
FROM comment
LEFT JOIN login ON comment.loginid=login.loginid
WHERE submissionid=$submissionid
ORDER BY comment.datecommented DESC 
LIMIT 100";         

$result = mysql_query($sqlStr);

$arr = array(); 
echo "<table class=\"commentecho\">";
while ($row = mysql_fetch_array($result)) { 
    echo '<tr>';
    echo '<td class="commentname1">'.$row["comment"].'</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="commentname2"><a href="http://www...com/sandbox/members/index.php?profile='.$row["username"].'">'.$row["username"].'</a>'.date('l, F j, Y &\nb\sp &\nb\sp g:i a &\nb\sp &\nb\sp  \N\E\W &\nb\sp \Y\O\R\K &\nb\sp \T\I\M\E', strtotime($row["datecommented"])).'</td>';
    echo '</tr>';
    }
echo "</table>";    




echo '<form action="http://www...com/sandbox/comments/comments2.php" method="post"> 
   <input type="hidden" value="'.$_SESSION['loginid'].'" name="uid">
    <input type="hidden" value="'.$submissionid.'" name="submissionid">  
    <input type="hidden" value="'.$submission.'" name="submission">

    <label class="addacomment" for="title">Add a comment:</label>
    <input class="commentsubfield" name="comment" type="comment" id="comment" maxlength="1000">  

    <div class="commentsubbutton"><input name="submit" type="submit" value="Submit"></div> 
</form>
';

编辑:这是我尝试过的最新相关CSS(它没有用)。

table.commentecho {
    position:absolute;
    left:30px;
    top:180px;
    text-align: left;
    font-family: "Times New Roman", Times, serif;
    font-weight: normal;
    font-size: 15px;
    color: #000000;
    width: 800px;
    table-layout:fixed;
    background-color: #FFFFFF;
    border: 2px #FFFFFF;
    border-collapse: collapse;
    border-spacing: 2px;
    padding: 1px;
    text-decoration: none;
    vertical-align: text-bottom;    
    margin-bottom: 30px;

}

table.commentecho td {
   border: 2px solid #fff;  
   text-align: left; 
   height: 18px;
   overflow:hidden;

}

table.commentecho td a{
   padding: 2px;
   color: #000000;
   text-decoration: none;
   overflow:hidden;
   height: 18px;
}

table.commentecho td a:hover{
   background-color: #FFFFFF;
   padding: 2px;
   color: #FF0000;
   text-decoration: none;
   overflow:hidden;
   height: 18px;
}   

.commentname1 { width: 550px;
            overflow:hidden !important;
            color: #000000;
            vertical-align: 

}

.commentname2 { width: 50px;
            overflow:hidden !important;
            color: #793D00;
            font-family:Arial, Helvetica, sans-serif;
            font-size: 10px;
            font-weight: bold;
            height: 18px;
            padding-bottom: 22px;

}

.commentsubfield { display: block; margin-left: 30px; width: 390px; height: 90px; border: 1px solid #999999; padding: 5px; }    

.addacomment
    {
    display: block; /* override the default inline display */
    margin-left: 30px; /* The 30px from the left you wanted */
    font-family:Arial, Helvetica, sans-serif;
    font-size: 12px;
    color:#000000;
    }   



.commentsubbutton
    {
    display: block; /* override the default inline display */
    margin-left: 30px; /* The 30px from the left you wanted */
    width:250px;
    text-align: left;
    margin-bottom:3px;
    padding:0px;
    font-family:Arial, Helvetica, sans-serif;
    font-size: 11px;
    color:#000000;
    }

1 个答案:

答案 0 :(得分:1)

您可以将表单设为style="margin-top: 30px"