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

use inline custom props to determine Grid Object layout #18

Open
chharvey opened this issue Nov 7, 2017 · 0 comments
Open

use inline custom props to determine Grid Object layout #18

chharvey opened this issue Nov 7, 2017 · 0 comments

Comments

@chharvey
Copy link
Owner

chharvey commented Nov 7, 2017

allow custom properties to determine layout:

.o-Grid {
  grid-template-rows   : repeat(var(--rows, 1), 1fr);
  grid-template-columns: repeat(var(--cols, 1), 1fr);
}
<ul class="o-Grid" style="--rows: 2; --cols: 3;">
  <li class="o-Grid__Item">1</li>
  <li class="o-Grid__Item">2</li>
  <li class="o-Grid__Item">3</li>
  <li class="o-Grid__Item">4</li>
  <li class="o-Grid__Item">5</li>
  <li class="o-Grid__Item">6</li>
</ul>

In the future:

.o-Grid {
  grid-template-rows   : repeat(attr(data-rows integer, 1), 1fr);
  grid-template-columns: repeat(attr(data-cols integer, 1), 1fr);
}
<ul class="o-Grid" data-rows"2" data-cols="3">
  <li class="o-Grid__Item">1</li>
  <li class="o-Grid__Item">2</li>
  <li class="o-Grid__Item">3</li>
  <li class="o-Grid__Item">4</li>
  <li class="o-Grid__Item">5</li>
  <li class="o-Grid__Item">6</li>
</ul>
@chharvey chharvey changed the title idea for Grid Object use inline custom props to determine Grid Object layout Nov 7, 2017
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

No branches or pull requests

1 participant