Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default padding on .container is overridden by conditional padding of smallest breakpoint. #654

Open
Leftium opened this issue Jan 29, 2025 · 0 comments · Fixed by Yohn/PicoCSS#55

Comments

@Leftium
Copy link

Leftium commented Jan 29, 2025

Describe the issue

Default padding on .container is overridden by $first-breakpoint conditional padding.

  • Only the smallest breakpoint should have padding: 0. All other larger breakpoints should get non-zero padding.
  • However, due to the order of the CSS statements and CSS cascade, all breakpoints end up with 0 padding.
  • SASS:
    padding-right: var(#{$css-var-prefix}spacing);
    padding-left: var(#{$css-var-prefix}spacing);
    }
    .container {
    $first-breakpoint: true;
    @each $key, $values in $breakpoints {
    @if $values {
    @media (min-width: map.get($values, "breakpoint")) {
    max-width: map.get($values, "viewport");
    @if $first-breakpoint {
    $first-breakpoint: false;
    padding-right: 0;
    padding-left: 0;
  • Resulting CSS:

    pico/css/pico.css

    Lines 669 to 676 in 6dc6489

    padding-right: var(--pico-spacing);
    padding-left: var(--pico-spacing);
    }
    @media (min-width: 576px) {
    .container {
    max-width: 510px;
    padding-right: 0;

Current Behavior

  • Padding is missing on .container

Expected Behavior

  • Element .container should have padding (except for smallest breakpoint).

Reproduction URL

  • Just inspect CSS compiled from Pico SASS:

    pico/css/pico.css

    Lines 661 to 679 in 6dc6489

    /**
    * Container
    */
    .container,
    .container-fluid {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: var(--pico-spacing);
    padding-left: var(--pico-spacing);
    }
    @media (min-width: 576px) {
    .container {
    max-width: 510px;
    padding-right: 0;
    padding-left: 0;
    }
    }
Leftium added a commit to Leftium/PicoCSS that referenced this issue Jan 29, 2025
Leftium added a commit to Leftium/leftium.com that referenced this issue Jan 29, 2025
- (This CSS is actually a workaround for picocss/pico#654)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant