question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS @page rule seems to be ignored if imported by @import rule

See original GitHub issue

Hello,

while referencing a file pagerule.css containing

/* rule #1 */
@page {
  size: A4;
  margin-top: 1.5cm;
  margin-right: 1.5cm;
  margin-bottom: 1.5cm;
  margin-left: 2.5cm;
}

/* rule #2 */
body {
  background-color: lime;
}

directly in HTML via

<link rel="stylesheet" href="pagerule.css" />

works like a charm, it seems that importing the file via CSS

@import url("pagerule.css");

or

@import url("pagerule.css") all;

into a referenced CSS file only processes rule #2 while rule #1 (the page rule) is completely ignored. On weasyprint command line interface with verbosity switched on, no warnings or errors are printed.

In Chrome print preview this is rendered correctly.

Is this a bug or intended behaviour?

Best regards,

Bernd

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
liZecommented, Nov 16, 2017

Is the fix commit merged in master?

Yes, it is.

0reactions
kinationcommented, Nov 15, 2017

@liZe Okay, thanks. Is the fix commit merged in master?

Read more comments on GitHub >

github_iconTop Results From Across the Web

import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >
CSS @import and the order of it - Stack Overflow
The '@import' rule allows users to import style rules from other style sheets. In CSS 2.1, any @import rules must precede all other...
Read more >
@import · WebPlatform Docs
The rule has no default value. The semicolon in the syntax is required; if omitted, the style sheet is not imported properly and...
Read more >
Beware of @import rules when concatenating CSS files
Be careful when using @import rules in CSS files that are concatenated before being deployed.
Read more >
Solving the React Error: Not Picking Up CSS Style | Pluralsight
Here, the CSS file is saved outside the src folder, so the compiler failed to import it. To make this code work, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found