Scope & CSS Grid - VSADX/scoped-css GitHub Wiki
- Find the element you want to give grid rules to
- Place a
<style class="scoped">
inside - Type
\& { display: grid; }
- Add any other grid settings there also
<section>
<div> Column One </div>
<div> Column Two </div>
<style class="scoped">
\& {
display: grid;
grid-template-columns: 1.5fr 1fr;
}
</style>
</section>
What's next? Try complex grid layouts
You can reorder HTML elements in your grid from CSS using the
order: <number>;
property. This works great with >
selector
in CSS.
<section>
<div> Please show second </div>
<aside> Show this first </aside>
<style class="scoped">
\& { display: grid; }
\& > aside {
order: -1;
}
</style>
</section>