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
https://forums.phpfreaks.com/topic/116615-making-div-stretch-right/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.