Resizing to page width for print style sheet
Posted
by rampion
on Stack Overflow
See other posts from Stack Overflow
or by rampion
Published on 2010-04-19T17:28:45Z
Indexed on
2010/04/19
17:33 UTC
Read the original article
Hit count: 164
So I've got a page that shows an image with some absolutely positioned text on top of it.
I want to write a print style sheet for it so that:
- the image is resized to fit the width of the page
- the text is repositioned and resized to maintain relative position and size with the image behind it
So I know I can do (1) with just max-width: 100%
, but I'm not sure how to accomplish (2). I'm okay with using some javascript if necessary, but I wanted to know if there's a way to do this in pure CSS. If I do need to use javascript, what can I hook to check for the pixel width of the image in the printed page? Just use the calculated width as normal?
And yes, this question might be more appropriate for DocType, but I've yet to get any help over there.
© Stack Overflow or respective owner