Does not accept custom breakpoints as ems
See original GitHub issueWe all now, that relay just on pixels is not enough, so I tried to have breakpoints based on em values, but some how converts these em values to new ems:
I am using: “next”: “^8.0.0”, “react”: “^16.8.1”, “react-dom”: “^16.8.1”, “styled-breakpoints”: “^6.6.2”, “styled-components”: “^4.1.3”, “styled-normalize”: “^8.0.6”, “styled-theme”: “^0.3.3”
const theme = {
breakpoints:{
xs: '30em',
sm: '50em',
md: '60em',
lg: '80em',
xl: '120em',
}
}
const Container = styled.div`
${down('md')} {
color: rebeccapurple;
}
`
This is what I got SSR rendered:
/* sc-component-id: PageTitle__Container-c1sqxi-0 */
@media (min-width:48em) and (max-width:61.99875em){
.bsEiBw{color:rebeccapurple;}
}
@media (min-width:1.875em) and (max-width:3.12375em){
.jQjQlc{color:rebeccapurple;}
}
@media (min-width:3.125em) and (max-width:3.74875em){
.bBciUM{color:rebeccapurple;}
}
@media (max-width:2.62375em){
.haykbX{color:rebeccapurple;}
}
@media (max-width:47.99875em){
.imXVfl{color:rebeccapurple;}
}
@media (max-width:4.99875em){
.bANXey{color:rebeccapurple;}
}
@media (max-width:4.99875em){
.gZDZUq{color:rebeccapurple;}
}
@media (max-width:4.99875em){
.pTrKY{color:rebeccapurple;}
}
If I use px as breakpoint values, then all is working as expected.
Current element has class gZDZUq
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How To Use CSS Breakpoints For Responsive Design
CSS media query breakpoints can be selected based on the device on which the website is being rendered. However, this is not a...
Read more >Issue with min and max media queries due to using ems?
I've built a few sites with both min and max width media queries, and for me they've been painfully difficult to maintain and...
Read more >Approaches to Media Queries in Sass - CSS-Tricks
If an operator is found, it is extracted and any matching breakpoint will be returned, or else we assume it's a custom value...
Read more >Switching between breakpoints causes useBreakpoint to ...
log I have been using inside the use-breakpoint snippet above doesn't seem to log the md breakpoint when using createBreakpoints (and ems not...
Read more >Additional Custom Breakpoints - Technical Details and Gotchas
There you go, the Additional Custom Breakpoints experiment should now be ... Elementor is no longer going to support accessing responsive ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mg901 Could the lib just not be concerned about the units of measurement being used by removing the unit conversion like: https://github.com/DanWebb/styled-breakpoints/commit/2cc404ae01ce0060ac0e5d36266905439c0073a2 this will be needed because once you add
px
someone will come along asking forrem
thenpt
…Is the reason you currently need the conversion due to how getting the next breakpoint value works?
@lauriskuznecovs, first of all, I want to thank you for using styled-breakpoints. I will fix this problem within 24 hours. If you can fix this faster, send me a PR decision.