...

View Full Version : The dreeded putting div's next to each other......



craig101
05-11-2011, 12:20 PM
I'm tearing my hair out here (well would be if i had any) i want Div's next to each other, its basically displaying items that has been returned from a search, so there could be a maximum of 4 div's next to each other, or just one alone, this is the PHP, inside a while loop


while ($lookup[$lc] != "") {
$qry = "SELECT * FROM Stock WHERE LOOKUP = '$lookup[$lc]'";
$result = mysql_query($qry);
$row = mysql_fetch_array($result);

$stocktype = $row['STOCKTYPE'];
$img = $row['IMAGE'];

if ($img == "") {
$img = "Images/nia.jpg";
} else {
$img = "Images/" . $img;
}

list($width, $height, $type, $attr) = getimagesize($img);
if ($width > $height) {
$no = $width / 100;
$h = $height / $no;
$w = 100;
} else {
$no = $height / 100;
$w = $width / $no;
$h = 100;
}

echo "<div class\"wrapper\">";
echo "<img src= $img width=$w height=$h/>";
echo "</div>";
$lc++;
}

and the CSS


.wrapper {
position: relative;
float: left;
padding:3px;
width: 150px;
}

AndrewGSW
05-11-2011, 12:27 PM
echo "<div class=\"wrapper\">";

craig101
05-11-2011, 12:36 PM
Wow now i feel like a idiot, i guess in future don't do a all-nighter when coding, in the entire 8 hours i never noticed that was missing *facepalm* thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum