Code and presets
Exporting code
GridFlow writes plain, readable CSS and HTML that you can paste straight into any project.
Copy or download #
- Copy CSS copies the CSS block.
- Copy HTML copies the HTML block.
- Download HTML + CSS saves
gridflow-layout.html: a complete page with the CSS in a<style>block and the HTML in the body. Open it in a browser to see your layout on its own.
If your browser blocks clipboard access, GridFlow selects the code instead and the button says Press Ctrl+C.
The rules behind the CSS #
- One container rule,
.grid, then one rule per item, in the order the items were added. - Every item has an explicit position (
grid-columnandgrid-row, orgrid-areawith named areas). Your layout never depends on the browser's auto-placement order, so adding or reordering HTML elements can't move things. - Start and span shorthand:
grid-column: 3 / span 2means "start at line 3, span 2 columns". A single-track item is written asgrid-column: 3. - Only what you set: alignment, size and auto placement are left out unless you change them, and a 0 gap is left out.
- Repeated tracks are grouped with
repeat(). - Valid only: invalid input never reaches the code.
- No preview styles: item colours, outlines and the + cells are never included.
The downloaded file #
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Grid layout</title>
<style>
/* Layout CSS generated with GridFlow */
.grid { … }
/* Preview only: makes the items visible. Delete this rule in your project. */
.grid > * { padding: 16px; border: 1px solid #c7c7e6; … }
</style>
</head>
<body>
<div class="grid"> … </div>
</body>
</html>
The last rule only gives the items a border and background so the layout is visible. Leave it out when you copy the CSS into your project.
Using the code in a project #
- Paste the CSS into your stylesheet.
- Paste the HTML where the layout should go, and replace the placeholder text with your content.
- If
.gridor an item's class name clashes with your own classes, rename it in both the CSS and the HTML.