Container

.container
.container--narrow
@use 'sprucecss/scss/spruce' as *;

.container {
  --inline-size: #{config('container-inline-size', $layout, false)};
  --gap: #{spacer-clamp('m', 'l')};

  @include layout-center(
    var(--gap),
    var(--inline-size)
  );

  &--narrow {
    --inline-size: 50rem;
  }
}
<div class="container">
    <div class="bit">.container</div>
</div>
<div class="container container--narrow">
    <div class="bit">.container--narrow</div>
</div>

Container

The container is the most generic element of our layout. With this snippet, you can manage and customize it as you wish.

Variations

  • default: uses the container-inline-size value for width from the $layout map.
  • --narrow: uses 50rem container width.

Technical Details

  • You only need to modify the --inline-size variable to add new variations.
  • The --gap variable (that controls the inline margin) uses the clamp function to make it more dynamic.

Documentation

Learn about Spruce CSS through our extensive documentation.

Components

Explore our extensive UI library built with Spruce CSS.

Blog

Read about front-end development and concepts of Spruce CSS.

Find us on GitHub

Did you find a bug? Have an idea or a question? Please open an issue to help us develop the project.