Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Nth offset option for column proposal #538

Description

@corbanbrook

I find that it is sometimes useful to be able to offset the nth-child indexing when using cycle.

I propose the addition of an additional option, $nth-offset to the column mixin which would allow one to offset by a certain number. It would default to 0 which would have no effect.

Applied like this:

@if $cycle != 0 {
    &:#{$nth-selector}(n) {
      margin-#{_opposite-direction($side)}: $margin-r * 1%;
      float: $side;
      clear: none;
    }

    &:#{$nth-selector}(#{$cycle}n + #{$nth-offset}) {
      margin-#{_opposite-direction($side)}: $margin-last * 1%;
      float: _opposite-direction($side);
    }

    &:#{$nth-selector}(#{$cycle}n + #{1 + $nth-offset}) {
      clear: both;
    }
  } @else {
    &:last-child {
      margin-#{_opposite-direction($side)}: $margin-last * 1%;
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions