
Originally Posted by
TechnoBear
the problem with the orange background. You need to float commentBottom to get it to wrap its contents.
I did float it.
I'm guessing commentBottom should be below commentBody,
Right.
so add a width (640px or whatever) to commentWrapper, which will force commentBottom onto a new line.
I have widths set on .userInfo and .userPost
You'll also need to float the parent div or add overflow:hidden to ensure it contains its children.
The parent is floated.
If you set the purple background on .userInfo rather than on .contentBody, then it won't continue for the full width of the div.
Why does the purple on .userInfo appear to go the whole width of commentBody and thus go behind .userPost??
(That was my key question in my original post)
I'm not sure where you were thinking of using position:relative, but don't.
Paul O uses position: relative a lot when laying out pages...
Here is my updated code...
HTML Code:
<div class="commentWrapper">
<div class="commentBody">
<div class="userInfo">
<a href="#" class="username">
<strong>DoubleDee</strong>
</a>
<img class="noborder" src="/uploads/' . $photoName . '" width="100" alt="" />
<dl>
<dt>Joined:</dt>
<dd>Jan 2012</dd>
<dt>Location:</dt>
<dd>Phoenix, AZ</dd>
<dt>Posts:</dt>
<dd>119</dd>
</dl>
</div>
<div class="userPost">
<span class="commentDate">Posted on: 2012-03-14 9:25am</span>
<span class="commentNo">#1</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
<div class="commentBottom">LOOK</div>
</div>
Code CSS:
#boxComments .commentWrapper{
float: left;
background-color: #FFFFCC; /* Buff */
}
#boxComments .commentBody{
float: left;
margin: 20px 0;
background-color: #A0A; /**/
/* background-color: #FFC; /**/
border-top: 1px solid #333;
}
#boxComments .userInfo{
float: left;
width: 170px; /**/
padding: 10px 0px 0 0; /**/
font-size: 0.9em;
text-align: center;
}
#boxComments .userInfo a{
padding: 0 0.7em 0 0;
color: #0071D8;
font-size: 1.1em;
font-weight: bold;
text-decoration: none;
}
#boxComments .userInfo dl{
margin: 0;
padding: 10px 0 0 0;
}
#boxComments .userInfo dt{
float: left;
width: 4.5em;
text-align: right; /**/
}
#boxComments .userInfo dd{
margin: 0 0 0 5em;
text-align: left;
}
#boxComments .userPost{
float: left;
max-width: 430px; /**/
/* FIX THIS */
min-width: 430px; /**/
padding: 10px 20px 20px 20px; /**/
font-size: 0.9em;
background-color: #F4F4F4; /**/
}
#boxComments .commentDate{
display: inline-block;
padding: 0 0 10px 0;
color: #AAA;
}
#boxComments .commentNo{
display: inline-block;
float: right;
padding: 0 0 10px 0;
color: #AAA;
}
#boxComments .commentBottom{
float: left;
margin:0;
padding: 0;
background-color: orange; /**/
}
Here is what I am still not understanding...
1.) Why does the purple extend all the way across .commentBody?
2.) How can I make the shading Full-Height for .userInfo and .userPost? (It almost looks like .userPost is inside of .userInfo?!)
3.) Why doesn't the orange background extend the whole width of .commentBottom (and .commentBody)?
Thanks,
Debbie
Bookmarks