Forum How do I...?

Position absolute relative to other item

tommyp
I am trying to position a div absolutley so it sits to the side of another element that is centered.

This technique works fine in a browser (see in_browser.jpg) but in prince the behaviour is unexpected. The top of the abs positioned div is the top of the margin of the first. The left is much further over than you'd expect.

Is this a bug?

div.bridgefull {
width:200px;
margin:1em auto 1em auto;
position: relative;
page-break-inside: avoid;
}

div.bridgeinfo {
position:absolute;
left:-120px;
width:120px;
  1. in_browser.jpg34.9 kB
    In Browser
  2. in_prince.jpg6.9 kB
    In Prince
tommyp
Resolved this.

Just needs top:0; to line up vertically.

Horiz difference is down to using px.