Reputation: 1727
I am building a forum listing using DIVs and here is the one I have
/* forum like build */
.myForum{
float: left;
width: 620px;
margin-top: 10px;
border: 2px solid #0F5C8E;
padding: 1px;
overflow: hidden;
display: block;
}
.myForum > .header {
height:10px;
background-color: #adcbe7;
border-bottom: 1px solid #0F5C8E;
font-weight: bold;
padding: 2px;
overflow: hidden;
height:20px;
}
.myForum > .myrow {
padding-left: 0px;
margin: 0px;
border-bottom: 1px solid #0F5C8E;
height:57px;
background-color: #f5f5f5;
}
.myForum > .myrow > .photo {
overflow: hidden;
width:105px;
float:left;
text-align:center;
padding-right: 2px;
padding-top:2px;
height:57px;
}
.myForum > .myrow > .content {
padding-left: 3px;
padding-right: 3px;
overflow: hidden;
width:450px;
float:left;
border-left: 1px solid #0F5C8E;
border-right: 1px solid #0F5C8E;
height:57px;
}
.myForum > .myrow > .mycount {
padding-right: 1px;
padding-bottom: 1px;
overflow: hidden;
float:left;
height:57px;
padding-left:3px;
}
.myForum > .myrow > .content > a {
color: #013E99;
font: bold 0.8em/1.3 arial,helvetica,sans-serif;
margin-top: 0;
}
.myForum > .myrow > .content > p {
font: normal 0.7em/1.3 arial,helvetica,sans-serif;
margin-bottom:2px;
color:#878787;
}
.myForum > .myrow > .content > p > a {
color: #0066CC;
margin-top: 0;
}
You can see alignment got messed up .
If I add extra padding-top to the third div (.myForum > .myrow > .mycount) , the alignment works just fine . But that disturbs the vertical lines ( second vertical line). You can see the modified one below
(I thought of using tables, But I see latest sites started using DIVs even for listings)
Upvotes: 1
Views: 159
Reputation: 3873
Looks like your padding on photo is causing the issue. Since there isn't enough hight in each row its over laping into the next. Simple example to show the issue. (It can be solved by either removing the padding or adding more height)
Change:
.myForum > .myrow > .photo {
overflow: hidden;
width:105px;
float:left;
text-align:center;
padding-right: 2px;
padding-top:2px;
height:57px;
}
To
.myForum > .myrow > .photo {
overflow: hidden;
width:105px;
float:left;
text-align:center;
height:57px;
}
Upvotes: 1
Reputation: 8666
This may not be the most syntactically correct way, but it works in your example:
.myForum > .myrow {
clear: both;
}
Upvotes: 1