Page 1 of 1

Div Row Colors Question [Resolved]

Posted: Fri Sep 13, 2013 12:16 am
by Epiales
Hey all...

I have set my data that has been called from the database into separate divs. Is there a way to make each row be a different color so they can be set apart and easier to see which one you'd like to purchase for the market? I've been searching for a bit now, but I can only change the background of like the "name" and the others don't change with it. I need the entire row to be a different color, but not figuring it out. Any help would be great. This is my code:

Code: Select all

<?php 
while ($row = mysql_fetch_assoc($rs_result)) { 
?> 
<form action="market.php" method="post">
<div>             
    <div align="left" class="left"><?php echo $row["name"]; ?></div>            
    <div align="center" class="center"><?php echo $row["amount"]; ?></div>
    <div align="center" class="right"><?php echo $row["price"]; ?></div>
    <input type="hidden" id="hidden" name="hidden" value="<?php echo $row["mid"]; ?>">
    <div><?php echo "<A href='market.php?mid=$row[mid]'?><font color='red'>Purchase" ?>;</a></font></div>
</div>
</form>
I've seen 100's of examples online for tables, but can't figure out the rows, using divs...

Re: Div Row Colors Question

Posted: Fri Sep 13, 2013 4:07 am
by a_bertrand
Why would you want to make it work with divs instead of tables?

Re: Div Row Colors Question

Posted: Fri Sep 13, 2013 4:15 am
by Epiales
a_bertrand wrote:Why would you want to make it work with divs instead of tables?
I have them in divs now and don't want to redo the entire thing :lol:

It's not a huge necessity, but would be nice to do it.

Re: Div Row Colors Question

Posted: Fri Sep 13, 2013 6:21 am
by a_bertrand
if your data needs to be displayed in a table like format (rows / columns) you should use the table tag. Using divs will actually slow down the rendering and makes your CSS a lot more complex.