Hello!
I am developing something like chat box and I want for example one post on one side then the other post on other side.
Example:
I want this in PHP (just for different sides)
Just use the CSS nth-child selector - it's far easier. Either that, or in the loop displaying the shouts do soemthing like:
<?php
$pos = "left";
while ($shout = $db->fetch_array($query))
{
if ($pos == "left")
{
$pos = "right";
}
else
{
$pos = "left";
}
//etc
}
?>
Then, use the left and right as floats or whatever.
This reminds me of what Gaia Online did.
(2011-06-27, 01:56 PM)euantor Wrote: [ -> ]Just use the CSS nth-child selector - it's far easier. Either that, or in the loop displaying the shouts do soemthing like:
<?php
$pos = "left";
while ($shout = $db->fetch_array($query))
{
if ($pos == "left")
{
$pos = "right";
}
else
{
$pos = "left";
}
//etc
}
?>
Then, use the left and right as floats or whatever.
Hm... don't know what you mean.
What do you mean? You're writing out the shouts using a loop, right? Just use the basic code I gave. Or, as I said, you can use the nth-child selector:
.shout:nth-child(odd) {
float: left;
}
.shout:nth-child(even) {
float: right;
}
Or something.