tags:

views:

38

answers:

1

How do I declare that a DIV should be displayed in top-left corner of every page and not in its relative position.

I have a div like:

<div id=header>Document</div>

and I would like to display it on every page in top left corner using css like:

@page {
    size: 8.5in 11in;
    margin: 0.25in;
    border: thin solid black;
    padding: 1em;


     @top-left {
        content: ???? ;
      }
}

Thank you.

A: 

Doesn't

#header {
   position: fixed;
   top: 0;
   left: 0;
}

work? See Printing Headers. Also, have a look at the W3C specification of position: fixed.

EDIT: if I read the CSS 3 specs concerning Margin Boxes well enough, together with the CSS 2.1 specs about the content property, I don't think you can embed a <div> from your page into the contents of a Margin Box, alas.

Marcel Korpel
Nope, while this will place header on top left, it will be within page content area and not a page Margin box. Sorry, I should have specified that this is for print media.. See http://www.w3.org/TR/css3-page/#page-box-page-rule
icon911
@icon911: Nope, my fault, I didn't read your question well enough (and didn't look into the `@top-left` rules, which I didn't know before you linked to the CSS3 specs)
Marcel Korpel