Saturday, May 18, 2024
HomeCSSDistinction between `.myClass`, `& .myClass`, `&myClass`, (and nesting thereof) syntax in CSS/SASS/SCSS/MUI

Distinction between `.myClass`, `& .myClass`, `&myClass`, (and nesting thereof) syntax in CSS/SASS/SCSS/MUI


The next code snippet is proven in: https://mui.com/material-ui/react-slider/#music-player

<Slider
  aria-label="time-indicator"
  measurement="small"
  worth={place}
  min={0}
  step={1}
  max={period}
  onChange={(_, worth) => setPosition(worth as quantity)}
  sx={{
      shade: theme.palette.mode === 'darkish' ? '#fff' : 'rgba(0,0,0,0.87)',
      top: 4,
      '& .MuiSlider-thumb': {
          width: 8,
          top: 8,
          transition: '0.3s cubic-bezier(.47,1.64,.41,.8)',
          '&:earlier than': {
              boxShadow: '0 2px 12px 0 rgba(0,0,0,0.4)',
          },
          '&:hover, &.Mui-focusVisible': {
              boxShadow: `0px 0px 0px 8px ${
                  theme.palette.mode === 'darkish'
                    ? 'rgb(255 255 255 / 16%)'
                    : 'rgb(0 0 0 / 16%)'
                }`,
          },
          '&.Mui-active': {
              width: 20,
              top: 20,
          },
      },
      '& .MuiSlider-rail': {
          opacity: 0.28,
      },
  }}
/>

I do not absolutely grasp this syntax in CSS/SASS/SCSS/MUI (In Bakus-Naur kind (https://en.wikipedia.org/wiki/BackuspercentE2percent80percent93Naur_form)):

<.> | <&.> | <& .>myClass: {worth}

In addition to the nesting of this syntax:

<.> | <&.> | <& .>myClass: {<.> | <&.> | <& .>myNestedClass>: {worth}}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments