Techmate Posted August 14, 2011 Share Posted August 14, 2011 I am have an issue looping a picture with the name of the a person under it. My loop comes out with the name and picture next to each other. I need it to look like this. pic pic pic pic name name name name while ($list = mysql_fetch_assoc($sql)) { $name=$list['image']; $name=$list['name']; echo "<h1>" . $name . "</h1>" . "<img src=get.php?id=$listidagain&dbchange=$dbc width=40% border=0></a>"; } Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted August 14, 2011 Share Posted August 14, 2011 Hi techmate, what i would do is wrap it up in a div and float that one. Also instead of using a h1 element i rather use a h3 element but that is up to you. here is what i would do. Also I see you have a anchor closing tag but not a beginning one so i removed that for now. I also added an alt tag for the image always wise to include that for seo purposes if used correctly. while ($list = mysql_fetch_assoc($sql)) { $name=$list['image']; $name=$list['name']; echo '<div class="person"><h3>' . $name . "</h3>" . '<img src="get.php?id=$listidagain&dbchange=$dbc" width="40%" border="0" alt=""></div>'; } than in css you just do div.person{float:left;margin:10px;} Quote Link to comment Share on other sites More sharing options...
Techmate Posted August 14, 2011 Author Share Posted August 14, 2011 I tried it and it works with text but not images? Do you have another way? Thank you for the responds Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted August 14, 2011 Share Posted August 14, 2011 I tried it and it works with text but not images? Do you have another way? This should work just fine with images(if the dimensions are correct). If you have an online example of what you say is not working I am happy to have a look at it. Quote Link to comment Share on other sites More sharing options...
Techmate Posted August 14, 2011 Author Share Posted August 14, 2011 This is a test image but as you see they are each other. I need it image image image name name name http://lastrider.servepics.com/Video22/gallery.php?dbchange=Test Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted August 14, 2011 Share Posted August 14, 2011 Look at your source: <div class="person"> <h3> <img width="40%" border="0</h3" src="get.php?id=23&dbchange=Test">Test<br> </h3> </div> don't place the image inside the <h3> element. Do as this <div class="person"> <img width="40%" border="0</h3" src="get.php?id=23&dbchange=Test"> <h3> Test </h3> </div> Also it would be smart to give Div with class person some fixed dimensions so it looks the same for each item just add the dimension to the class. for instance: div.person { background: none repeat scroll 0 0 #EEEEEE; float: left; height: 200px; margin: 10px; width: 200px; } p.s. I ones wrote a litle article on this, you might want to check it out Quote Link to comment Share on other sites More sharing options...
Techmate Posted August 15, 2011 Author Share Posted August 15, 2011 It worked thanks but if you take another look the pagination number is in the upper right conner of the screen. I need it to be in the lover left side of the screen Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted August 15, 2011 Share Posted August 15, 2011 It worked thanks but if you take another look the pagination number is in the upper right conner of the screen. I need it to be in the lover left side of the screen Don't keep adding things to the threads wish list, it makes them long and chaotic. The threads question is answered and solved. To give a brief answer to your last question. The properties involved in positioning are Float, and the positions relative and absolute Google those bold words for tutorials or get a decent book. We are not here to write your code we are here to assist with your code (your efforts). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.