View Single Post
  #1 (permalink)  
Old Jul 29th, 2006, 00:00
AdRock's Avatar
AdRock AdRock is offline
SuperMember

SuperMember
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Is it possible to align images in a div class?

Is it possible to align an image in a div class?

I use some php to display some news items whcih uses a 2 different div classes alternating them so in theory in one class the image can be aligned right and the other class, the image aligned left.

I don't know if this is even possible and how I do it.

This is the php to alternate the div classes
PHP: Select all

if($i 2) { //this means if there is a remainder
echo "<div class=\newstop\">\n";
} else { 
//if there isn't a remainder we will do the else
echo "<div class=\"newsbottom\">\n";
}
echo 
"<b>".$code['title']."</b><br>".$code['time']."<br>".$code['content']."<br><br>\n";
echo 
"</div>\n"
These are the div classes (need to be tidies up when working correctly
Code: Select all
 
.newstop /* used for when adding news items */
{
width: 500px;
float: right;
margin-right: 10px;
margin-bottom: 10px;
padding: 5px;
text-align: justify;
border: solid 1px #383838;
background-color: #323232;
}
.newsbottom /* used for when adding news items */
{
width: 500px;
float: right;
margin-right: 10px;
margin-bottom: 10px;
padding: 5px;
text-align: justify;
border: solid 1px #383838;
background-color: #232323;
}
Is what i'm trying to do possible or am i going to have to stick them all being aligned left or right?
Reply With Quote