I have the following quick html test which is a simplified version of something I am trying to do. What I am not sure about is why the "details" area (with red border doesn't line up on the right hand side with everything else. What am I doing wrong?
CSS:
.landscapepage {
position:relative;
width: 280mm;
height: 190mm;
page-break-after: always;
}
div.header {
position:relative;
min-height: 30mm;
width: 100%;
border-style:solid;
border-width: medium;
border-color:Gray;
text-align:center;
}
div.footer {
position:absolute;
min-height:30mm;
border-style:solid;
border-width:medium;
border-color:Gray;
text-align:center;
width: 100%;
bottom: 0pt;
}
div.summary {
position:relative;
width: 80mm;
min-height: 20mm;
display:table-cell;
border-style:solid;
border-width:medium;
border-color:Navy;
}
div.details {
position:relative;
display:table-cell;
border-style:solid;
border-width:medium;
border-color:Red;
min-height:20mm;
width:100%;
}
HTML:
<div class="landscapepage">
<div class="header">
Header
</div>
<div class="summary">
Summary
</div>
<div class="details">
Details
</div>
<div class="footer">
Footer
</div>
</div>
Please see this jsFiddle .
It's all about border width.
When you set no borders, but background color you get something like this http://jsfiddle.net/cRZbw/1/ where "Details" is correctly aligned with "Header".
div.header {
position:relative;
min-height: 30mm;
width: 100%;
background:gray;
text-align:center;
border:1px solid red;
}
div.footer {
position:absolute;
min-height:30mm;
background:gray;
text-align:center;
width: 100%;
bottom: 0pt;
}
div.summary {
position:relative;
width: 80mm;
min-height: 20mm;
display:table-cell;
background:navy;
}
div.details {
position:relative;
display:table-cell;
background:red;
min-height:20mm;
width:100%;
}
Might be you want to do this: http://jsfiddle.net/cRZbw/2/ Change div.footer's position to relative.
Here is the code:
div.footer {
position:relative;
min-height:30mm;
border-style:solid;
border-width:medium;
border-color:Gray;
text-align:center;
width: 100%;
bottom: 0pt;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.