Skip to content

Implement and document new grid helper #161

Description

@geoffrey-eisenbarth

Questions

  • Should we still have separate "Flexbox" and "Grid" sections in the navbar? If not, where do we move the content to?

Possible impls

Blocked: @scope in Firefox. Update: no longer blocked
Blocked: attr() for <custom-ident> in Firefox (I think? mdn isn't clear on this): Update: still blocked: https://caniuse.com/mdn-css_types_attr_type_function_ident

Possible new syntax from @dz4k

<style>
.grid {
  [id] {
    grid-area: attr(id);
  }
}
</style>

<div class="grid" style="
  grid-template: if(
    media(width < 768px), 'title' 'nav' 'content',
    'title title' 'nav content' / auto 1fr
  )
">
  <h1 id=title>...</h1>
  <nav id=nav>...</nav>
  <div id=content>...</nav>

More suggestions from deniz:

.layout-grid {
  display: grid;
  gap: var(--gap);
  margin-block: var(--gap);

  @media (max-width: 768px) {
    display: flex;
    flex-flow: column nowrap;
  }
}

Usage:

<article class="layout-grid" style="grid: 1fr / 1fr 2fr">
<!-- or -->

<article class="layout-grid" style="
  grid-template:
  'image title' auto
  'image desc' 1fr
  /auto  1fr
">

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions