How to make my chat div's appear below each other

I am making a small chat and I am having issues making the div's appear below each other. This is what I have:

$i = 0;
while($i < 5)
{
echo "<div class='MyChatholders'>";
 echo "<div class='pro_pic'>";
  //my image
 echo "</div>";
echo "<div class='ChatInfo'>";
//my information
echo "</div>";
echo "</div>";
echo "<br />";

$i++;
}

MY CSS:

div.MyChatholders
{
left: 5px;
color: black;
width: 290px;
height: 100px;
border-radius: 10px;
}
div.pro_pic
{
left: 5px;
width: 30px;
height: 30px;
border: solid black 1px; 
}
div.ChatInfo
{
color: black;
font-size: 14px;
left: 40px;
width: 245px;
}

Please note that the (while function) is just to simulate the information drawn from the DBase.

Now my issues is that all the div's are in one position. I would like them to fall below each other. I do not understand why this is happening. Can someone help me with my code and explain why?

I have looked at this solution but it is not working for me Check here

Answers


Add position:relative; to your divs.

Working fiddle based on your code: http://jsfiddle.net/MmGyU/1/

Note: Borders in the fiddle are for demonstration purposes.

div.MyChatholders {
    position: relative;
    left: 5px;
    color: black;
    width: 290px;
    height: 100px;
    border-radius: 10px;
}
div.pro_pic {
    position:relative;
    left: 5px;
    width: 30px;
    height: 30px;
}
div.ChatInfo {
    position:relative;
    color: black;
    font-size: 14px;
    left: 40px;
    width: 245px;
}

Need Your Help

how to get max number from a file with Linux bash shell scripts

bash file shell numbers max

How to get the maximum "rate" and the corresponding "log2c" value from a file as follows?

SBJson iOS parser methods are Deprecated?

ios json sbjson

I'm starting a new project with SBJson parser, which people seem to recommend as the best on the internet for new iOS projects. I'm having a really strage issue which is that the current methods S...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.