Div Row Colors Question [Resolved]

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Div Row Colors Question [Resolved]

Post 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...
Last edited by Epiales on Tue Sep 24, 2013 8:30 pm, edited 1 time in total.
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: Div Row Colors Question

Post by a_bertrand »

Why would you want to make it work with divs instead of tables?
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Div Row Colors Question

Post 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.
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: Div Row Colors Question

Post 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.
Creator of Dot World Maker
Mad programmer and annoying composer
Post Reply

Return to “Beginner Help and Support”