php - show image background 1 if div is on the left and show background 2 if image is on the right? -
hi wonder if can help, not entirely sure possible have div container called <div class="scroll">
inside div scroll sql query echoes comments posted users database. div scroll set width of 600px , comments arranged in div left right, theres 2 comment boxes on each line, each comment box under 300px each align next each other.
the comments listed so:
<div class="scroll"> comment 1 | comment 2 comment 3 | comment 4 comment 5 | comment 6 </div>
the comments encased in div "comment_box"
now have done put background image div "comment_box" image pointer arrow points left , positioned on left hand side of div, want have second background image comment boxes align on right, in instance comments 2, 4 , 6 have different background image/an arrow points right on right hand side of div.
is possible?
thanks
comment box{ .wall_post_case_branch { background-image:url(../img/effects/arrow_left.png); background-repeat:no-repeat; background-position: center; height:90px; width:290px; position:relative; border:#ccc 1px solid; } mysql: <?php if(mysql_num_rows($wallposts_set) > 0) { while ($posts = mysql_fetch_array($wallposts_set)) { $age = days_from_date($posts['date_added']); ?> <div class="comment_box"> <?php echo "{$posts['content']}"; ?> </div>
you can below.
<?php $i = 0; while ($posts = mysql_fetch_array($wallposts_set)) { $class = ' odd'; if ($i++ % 2 == 0) { $class = ' even'; } echo '<div class="comment_box'.$class.'">'; } ?>
and in css
.odd { background-image:imageone.jpg; } .even{ background-image:imagesecond.jpg; }