Hi Guys, I hope i put this in the right place I want to show all items in two sections "left" and "right" using div class and php so in html view source code become as below <div class="col float_left"> <a href="#">left section...</a></div> <div class="cleaner"></div> <div class="col float_right"> <a href="#">right section...</a></div> <div class="cleaner"></div> HTML: and then i try it as using php code as following <?php $class = '_left'; ?> <div class="col float<?php echo $class ? '' . $class : $class ; ?>"> <a href="#">left section...</a></div> <?php $class = ($class == '_right') ? '_left' : '_right' ; ?> PHP: css code: but it doesn't work, please help me
Thanks for your fast reply the problem is that php code doesn't print to 2 sections (left & right), but only 1 section (all in left section), and the html source code view as following <div class="col float_left"> <a href="#">left section...</a></div> <div class="cleaner"></div> <div class="col float_left"> <a href="#">right section...</a></div> <div class="cleaner"></div> HTML:
thank You.. even i removed the first cleaner and add specific width for each div it's seem not work too
First up, "clearing div" are 1997 style garbage and have no place in a modern page. You should have the parent or the element after handling that for you. Second, your use of classes seems presentational in nature, you're not saying what they really are, you're just using classes willy-nilly. Classes like 'left' and 'right' being for the most part garbage that you might as well go back to writing HTML 3.2 if you're doing that. Third, I'm not sure I'm following why you are screwing around with an extra variable... since there's no padding you just make them the same class, and set that class to float:left; width:50%; In general though I'm getting the feeling we're not seeing enough of what's going on here.
Hi gvre, I have not screen yet, its only for learning, mean i want to show some items in page(s) that will look like, e.g. Left Right --------------------- item1 | item2 item3 | item4 item5 | item6 and etc.... I have seen as a sample odd and even, that look like similar to odd and even any idea... @deathshadow You right, but that any another idea that may useful to fix it? thank