Open MattSturgeon opened 7 years ago
Media queries are not supported at all for the moment, it's a good feature to have.
Another use-case for media queries (just making my case to prioritize this issue):
With @media (max-height:
you can for example select the first page (because the margins are bigger), and display a complex page footer (for example a table) with display:fixed that only shows up on the first page.
My bad, it's not a good first issue at all:
display
)I've pushed a media-queries
branch with initial work for supporting media queries.
Next steps:
style_for
object change its _cascaded_styles
and _computed_styles
attributes for each page depending on the curent page attributes (mainly width and height), and cache them to avoid recalculation for known attributes,root_box
for each page in Document._render
, using the updated style_for
object,resume_at
attribute to be independent from the root_box
(that's the really hard point).I can't work anymore on this point for version 43, it's too long. If anyone is interested, I can help.
With @media (max-height: you can for example select the first page (because the margins are bigger), and display a complex page footer (for example a table) with display:fixed that only shows up on the first page.
We could even add a custom -weasy-page-name
feature for that, instead of relying on page size :wink:.
We could even add a custom
-weasy-page-name
feature for that, instead of relying on page size .
And left/right pages, and page numbers, and…
I have the following line in a stylesheet:
When I use this with WeasyPrint I get the following warning:
From what I can tell, the
only
keyword is not being recognised, so perhaps unknown media types produce a parse error instead of a more descriptive warning andonly
is an unknown media type?only
is intended to filter out older browsers who don't support media queries but do support comma-separated media types.