tags:

views:

34

answers:

1

Hello,

For the code below, how could I make the form always appear 30 pixels below the bottom of the HTML table styled with "commentecho"?

Thanks in advance,

John

$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"].'"&gt;'.$row["username"].'&lt;/a&gt;'.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>
';

EDIT: Here is the most recent relevant CSS that I have tried (it did not work).

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  A: 

You could give the form a style="margin-top: 30px".

Pekka
What about the classes "addacomment," "commentsubfield," and "commentsubbutton"?
John
@John what about them? You could also give `commentecho` a `margin-bottom` in the class definition, depends on your preference.
Pekka
I just tried giving the form a "margin-top: 30 px" style, and it puts it 30 px below the top of the browser. How do I make it 30 px below the bottom of the HTML table?
John
I tried to give the HTML table a margin-bottom: 30 px attribute, and it had no effect on the form. The form is at the top of the browser.
John
@John can you post a live link?
Pekka
I'll post the relevant CSS.
John
@John `position: absolute` takes the table out of the document flow. It is impossible to position anything else relative to it. You would have to put the table and the form into a `div` container, and give the `div` the position: absolute.
Pekka
@Pekka, OK, thanks. What is a good way to not use absolute on the table, but have it always be in the same location?
John
@John I can't really say without seeing the page. Why are you using absolute in the first place? It should stay in the same location without as well.
Pekka
OK, by taking off the "absolute," I'm making some progress. Thanks for the guidance.
John