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.

Size shorthand is overwriting an existing CSS property

See original GitHub issue

I was mighty confused why my printing stylesheet wasn’t working, until I finally discovered that the size property was being replaced with width and height.

size is a property used for defining @page size

I might recommend wh as a shorthand instead, as it describes the format of the string to be passed, is shorter, and is generally more descriptive than size. On top of not conflicting with an existing property.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
thecrowkeepcommented, Mar 21, 2022

Opt out of shorthands with css prop.

This is certainly helpful, though @page is meant to be used in the root styles, so currently the only workaround I’m aware of is:

<Global
	styles={() => ({ '@page': { size: '4in 6in landscape' } }) }
/>
2reactions
hasparuscommented, Mar 22, 2022

A workaround to use until we figure out how to solve this:

Opt out of shorthands with css prop. Style objects you pass to css go directly to Emotion, so we’re not transforming the shorthand.

Edit: Better workaround in thecrowkeep’s post below ⬇

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shorthand properties - CSS: Cascading Style Sheets | MDN
Shorthand properties are CSS properties that let you set the values of multiple other CSS properties simultaneously. Using a shorthand property ...
Read more >
Overwriting transitioned CSS property via JS makes transition ...
This is happening because you're overriding the existing style by applying the style via style attribute on the HTML element.
Read more >
Accidental CSS Resets
Any time you use a shorthand property in CSS, you set all the values for all the properties it deals with. It's not...
Read more >
How to override the CSS properties of a class using another ...
To override the CSS properties of a class using another class, we can use the !important directive. In CSS, !important means “this is ......
Read more >
The Shorthand-Longhand Problem in Atomic CSS
It's about CSS specificity, shorthand and longhand properties in CSS ... it will always prioritize the second overwriting the first styles.
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