Skip to content

How should breakpoint-specific CSS (or SCSS) be applied (sm/md/lg/xlg/max)? #1602

Answered by theetrain
wbudd asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, I tried some experimentation and got a working demo here: https://stackblitz.com/edit/sveltejs-kit-template-default-inw664?file=src%2Froutes%2F%2Blayout.svelte,src%2Froutes%2F%2Bpage.svelte,src%2Fapp.scss&terminal=dev

+page.svelte

<script>
  import { Button } from 'carbon-components-svelte'
</script>

<div class="component">
  <Button>Click me</Button>
</div>

<style lang="scss">
.component {
  display: inline;

  /* applies styles inside mixin on md breakpoint or below, like max-width */
  @include carbon--breakpoint-down('md') {
    display: none;
  }
}
</style>

From what I can tell, once you have SCSS set up, mixins need to be imported on the page they're being used. Other than c…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wbudd
Comment options

@theetrain
Comment options

Answer selected by wbudd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1601 on December 29, 2022 01:43.