Search code examples
phpcssstylesheet

Unable to Style Div


Creating a blog from scratch is a difficult process but I've been plodding along with some minor issues which have been resolved. My minor issue today is the fact that I'm unable to style the site background with an image. I'm able to add colors but not an image.

The second minor issue is to do with my Div tags. I've created a basic form that submits comments to my MySQL database but when I attempt to style the div that I've enclosed the form and comments that are displayed the styles have not appeared. I have included my Comments CSS below and my post.php page.

CSS:

#comments-title {
    background-color: #282828;
    width: 567px;
    height: 30px;
    font-size: 25px;
    font-family: arial;
    color: #ffffff;
    padding: 5px;
    padding-top: 6px;
    padding-bottom: 4px;
}


#comment-list{
    border:1px solid #dadada;
    width: 567px;
    padding: 5px;
}

PHP:

<h2 id="comments-title">Comments</h2>
 <div id="comment-list'">
    <?php

}
$commenttimestamp = strtotime("now");

$sql = "SELECT * FROM php_blog_comments WHERE entry='$id' ORDER BY timestamp";
$result = mysql_query ($sql) or print ("Can't select comments from table php_blog_comments.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
    $timestamp = date("l F d Y", $row['timestamp']);
    print("<p id='comment'>" . stripslashes($row['comment']) . "</p>");
    printf("<p id='comment'>Comment by <a href=\"%s\">%s</a> @ %s</p>", stripslashes($row['url']), stripslashes($row['name']), $timestamp);
}
?>


<form method="post" action="process.php">

<p><input type="hidden" name="entry" id="entry" value="<?php echo $id; ?>" />

<input type="hidden" name="timestamp" id="timestamp" value="<?php echo $commenttimestamp; ?>">

<strong><label for="name">Name:</label></strong> <input type="text" name="name" id="name" size="25" /><br />

<strong><label for="email">E-mail:</label></strong> <input type="text" name="email" id="email" size="25" /><br />

<strong><label for="url">URL:</label></strong> <input type="text" name="url" id="url" size="25" value="http://" /><br />

<strong><label for="comment">Comment:</label></strong><br />
<textarea cols="25" rows="5" name="comment" id="comment"></textarea></p>

<p><input type="submit" name="submit_comment" id="submit_comment" value="Add Comment" /></p>

</form>
</div>

Solution

  • Take a second look at this line:

    <div id="comment-list'">
    

    See that little ' in there? Take it out.

    For everything else, you're going to have to be more specific. You've basically posted a large slab of code here without pointing to the offending code.