How can I get the text of the message next to the avatar and not below it?

So, I'm trying to create a forum with avatars, but right now the text goes below the avatars, not next to them. How can I fix this?

Here's the CSS:

.postbox{
    text-align: left;
    margin: auto;
    background-color: #dbfef8;
    border: 1px solid #82FFCD;
    width: 100%;
    margin-top: 10px;
}   

.postfooter{
    width: 100%;
    border-top: 1px solid #82FFCD;
}

.postheader{
    width: 100%;
    border-bottom: 1px solid #82FFCD;
}

.posttext{
    width: 70%;
    text-align: left;
    border: 1px solid #82FFCD;
}

.postavi{   
    width: 20%;
    text-align: left;
    border: 1px solid #82FFCD;
}

      

and here is the html:

<div class="postbox"><div class="postheader">
                            <b><span>CyanPrime!!~::##Admin##::~</span></b>

                        </div>
                        <div class="postavi"><img src="http://prime.programming-designs.com/test_forum/images/avatars/hacker.png" alt="hacker"/></div><div class="posttext">Let test the Hacker Avatar.</div>
                        <div class="postfooter">
                            [<a href="http://prime.programming-designs.com/test_forum/viewthread.php?thread=25">Reply</a>] 0 posts omitted.
                        </div>
                    </div>

      

+2


source to share


3 answers


You can wrap your divs in a div container and float. Remember to clean up your floats.



.clear { clear: both; }

.posttext{
    float: left;
    width: 70%;
    text-align: left;
    border: 1px solid #82FFCD;
}

.postavi{
    float: left;
    width: 20%;
    text-align: left;
    border: 1px solid #82FFCD;
}


<div>
  <div class="postavi"><img src="http://prime.programming-designs.com/test_forum/images/avatars/hacker.png" alt="hacker"/></div>
  <div class="posttext">Let test the Hacker Avatar.</div>
  <br class="clear"/>
</div>

      

+3


source


This should do it:



.postavi{ float: left}

      

0


source


Add CSS "float: left;" to the element that should allow text to be placed side by side.

0


source







All Articles