Jump to content

Making Div Stretch Right


Little Wing

Recommended Posts

I'm currently designing a forum software, and I've run into a problem with the posts. I use the DIV tags to contain all the content of each post, which will stretch vertically if the content cannot fit in the container, but will not stretch horizontally. Instead, if say I post a large image that is beyond the width of the page, it will just go over the borders of the container. Is there anyway I could force the side to stretch?

 

Btw, just another quick question if anyone has an opinion: should I be using tables or div for something like this?

 

EDIT: Here's my code if necessary (just ignore the php parts):

 

<?php
include("header.php");
echo "<link rel='stylesheet' type='text/css'
href='postview.css' />";

mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db("myforum") or die(mysql_error());

$threadName = $_GET['threadName'];

$result = mysql_query("SELECT * FROM $threadName");

echo "<div class='container'>";
echo "<header>
<style type='text/css' title='Neohome'>
div {cursor:crosshair}

div.container 
{
margin:0px; 
line-height:15px;
border: 1px solid #000000;
}

div.container2
{
margin:0px;
border-bottom: 1px solid #000000;
}

div.left
{
float:left;
width:130px;
margin:0px;
padding:1em;
}

div.content
{
margin-left:190px;
border-left:1px solid #000000;
padding:0.5em;
}
</style>
</header>";

while ($row = mysql_fetch_array($result))
{
$n = 180;
$post = $row['Post'];
echo "<div class='container2'>";
echo "<div class='left'>";
echo $row['User'];
echo "</div><div class='content'><div align='right'>";
echo $row['Date'];
echo "</div>";
echo $post;
echo "<br /><br /><br /><br /><br /><br />";
echo "<div align='right'>";
echo "<a href='http://localhost/editpostdisplay.php?postID=".$row['id']."&thread=$threadName'>Edit</a>";
echo "<a href='http://localhost/deletepostdisplay.php?postID=".$row['id']."&thread=$threadName&forwardto=$tehurl'>Delete</a>";
echo "</div></div></div>";
}
echo "</div>";
echo "<a href='threadreplydisplay.php?threadName=$threadName'>Reply</a>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.