Forum How do I...?

Fold marks

sasa
Hi guys,

I was wondering how to do a folding mark for an A4 page. I have tried to use a div with position absolute, but couldnt get it to work. Is there an easier way? These are the specs:

stroke width 0,75 pt
width 0,25 cm
horizontal position left 0,25 cm from left
vertikal position 10.6 cm from top

These are standard folding marks for german letters (A4)

-sasa
mikeday
You mean something like this:
<html>
<head>
<style>
@page {
    margin-left: 3.2cm;
    margin-right: 3.2cm;
    margin-top: 2.5cm
}

#fold {
    position: absolute;
    left: -2.95cm;    /* @page margin-left - 0.25cm */
    right: -2.95cm;   /* @page margin-right - 0.25cm */
    top: 8.1cm;       /* @page margin-top + 10.6cm */
    border-top: solid black 0.75pt
}
</style>
</head>
<body>

<div id="fold"></div>

</body>
</html>
adriencater
I've been struggling with this today, as well – the problem is breaking out of the page margins, positioning elements relative to the page. I have two cases:

1. I'd like to add some visual guides to the page, just to check positioning and whatnot (actually, to check what's happening in problem #2 below)

The most promising solution seems to be something like what @mikeday mentioned here http://www.princexml.com/bb/viewtopic.php?f=4&t=9062 which uses the @top-left-corner{} selector which places an element at the 0, 0 coordinates of the page itself. Though, I'm still having a bit of trouble with this, I think I just need to fiddle with it some more, and will post code here if I can't get it working.


2. There are some pages where I want to 'float' an element vertically outside of the top margin. Example would be all pages have a 50mm top margin, but H1 elements are removed from the normal content flow and placed at 20mm from the top of the page. To complicate things, I'm running different left-right margins for left-right facing pages, so the x-axis position might become an issue. For now, I have something which looks like this:

@page{ 
	margin-top:50mm;
}
H1{
	float:left;
	position:absolute;
	top:-30mm;
}


Which is essentially the solution mentioned here. But this seems a bit of a hack, since I'm specifying a position relative to an arbitrary margin and not the page itself, and if, say, some particular page as a different margin-top value for some reason, then this all breaks and my element is positioned wrong.


@mikeday: might there be a need to extend the position property, adding something like:

position: static | relative | absolute | fixed | page-absolute | margin-absolute 


where the page-absolute and margin-absolute values would position an element, as implied, explicitly in the coordinates of the page or the margins of the document.

It seems that this would be a 'legitimate' extension of standard CSS, since Prince has this additional page/margins dichotomy which is not present in a web browser viewport.
adriencater
Of course, that would be prince-page-absolute and prince-margin-absolute :D
adriencater
adriencater wrote:
2. There are some pages where I want to 'float' an element vertically outside of the top margin. Example would be all pages have a 50mm top margin, but H1 elements are removed from the normal content flow and placed at 20mm from the top of the page.


It just occurred to me that I could use a global margin of 20mm for all pages, and then add 30mm of padding for the pages I need, then position the H1 elements I want 'outside' to be set with position:absolute; top:0; which should place it at 20mm position of the margins? But alas, it seems that I can't break through the padding either!
mikeday
How about using a named flow to move it to a @page margin box and then positioning it from there?