Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8371855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:15:39+00:00 2026-06-09T14:15:39+00:00

I want something to look like a typical forum post where some user info

  • 0

I want something to look like a typical forum post where some user info is on the left of the post and then the post itself. I used two divs wrapped around another div and then used float on css. My problem is that the other div, when floated as well, wants to stay to the left rather than be ‘right next to’ the other div. I’ve tried display:inline; on the div and also changing it to span instead. The closest thing I have is only the top part of the other div does in the right place(when I do not float this div, only the first one). Think a typical IPB post layout. If that doesn’t make sense, here’s my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<div id = "contentarea">
    <div class = "post">
        <div class = "head">
            <p class = "name">asrockw7</p>
        </div>
        <div class = "body">
            <p class = "title">On the Origin of Species</p>
            <p class = "content">Integer hendrerit lectus sit amet turpis facilisis quis lacinia nulla tempus. Aliquam vitae ante eu sem vestibulum scelerisque. Cras dui neque, auctor eget rhoncus non, pretium a justo. </p>
        </div>
        <div class = "clear">clear:both;</div>
        <div class = "allreplies">
            <div class = "reply">
                <p class = "name">Wafer</p>
                <p class = "content">Vestibulum nec turpis eu mi imperdiet porttitor. Fusce eget lorem libero, a imperdiet sem. Integer eleifend tincidunt condimentum. Nam id arcu nec lectus rhoncus sagittis.</p>
            </div>
            <div class = "reply">
                <p class = "name">Arondight</p>
                <p class = "content">Suspendisse non eros orci, a porttitor lacus. Donec vulputate viverra neque, quis sagittis eros suscipit vel.</p>
            </div>
        </div>
        <div class = "clear">clear:both;</div>
    </div>
</div>
</html>

<style type = "text/css">
.clear {
background:white;
clear:both;
}
#contentarea {
margin-top:50px;
margin-left:10px;
min-width:700px;
}
p{
font-family:"Lucida Console";
}
.post {
opacity:0.9;
background:blue;
padding:5px 10px 5px 10px;
}
.post .head {
background:red;
float:left;
}
.post .body {
background:green;
}

.post .allreplies {
background:yellow;
}
</style>

The colors are just to be able to distinguish each part from the other. I figured this is because the body div doesn’t think it’ll fit next to the head div, so it goes down. I could have specified an explicit width and height and make the body div know it can fit but it would be bad for people with large resolution monitors. At this point, I was just tempted to use <table>.

These are all generated by PHP, just wanted to get the layout right first.

tl;dr:
Basically I want the head div and body div to be right next each other rather than having body div fall off because it doesn’t think it fits.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:15:41+00:00Added an answer on June 9, 2026 at 2:15 pm

    You can add x% width to .head and (100-x)% width to .body. Also, you can add float:left to .body as you did before. See fiddle.

    The way you have it right now, the .head element is taking up space on the top left, pushing the content in .body (which is not floated) to the right.

    When you don’t specify the width of a floated div, the .body div’s width is the minimum of the width of the content inside the div and the width of the parent. In this case, the content’s “width” is greater than the parent element’s width, so the .body div gets pushed to its own horizontal line. If you just have float:left on both .head and .body, it works correctly if there isn’t that much text in .content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some MET data I want to validate which would look something like
In C#, what I want would look something like this: IDictionary<string, action()> dict =
I want to make some html output look like this... Tag1 blah blah blah
I want to create an NSOutlineView subclass where some of the entries look like
I want to do something like this: .even { float: left; text-align: left; }
Some existing web services I consume have methods that look something like this: List<Employee>
I want something like the following: foo.should_receive(:bar).with(an_instance_of(Bla))..... Is this possible? Edit: According to the
I want something like the following but would like it to be reusable for
I want something that will receive me the processes details, like I receive with
I want something like a canvas, but where i'd be able to manipulate pixels

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.