Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-11-2011, 11:20 AM   PM User | #1
craig101
New Coder

 
Join Date: Apr 2011
Posts: 16
Thanks: 1
Thanked 1 Time in 1 Post
craig101 is an unknown quantity at this point
The dreeded putting div's next to each other......

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

PHP Code:
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

Code:
.wrapper {
position: relative; 
float: left; 
padding:3px;
width: 150px;
}
craig101 is offline   Reply With Quote
Old 05-11-2011, 11:27 AM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Code:
echo "<div class=\"wrapper\">";
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
craig101 (05-11-2011)
Old 05-11-2011, 11:36 AM   PM User | #3
craig101
New Coder

 
Join Date: Apr 2011
Posts: 16
Thanks: 1
Thanked 1 Time in 1 Post
craig101 is an unknown quantity at this point
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
craig101 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:16 AM.


Advertisement
Log in to turn off these ads.