About  |  Docs  |  Demos  |  Download

The blockstart.css

Quickly get your initial layout idea done with minimal CSS and HTML.

About blockstart.css

The blockstart.css file gives you a simple set of basic layout primitives to get started. It allows you to follow a simple process:

  1. Create a general monochrome block layout with little to no detail.
  2. Divide these simple layout blocks with smaller elements.
  3. Refine these smaller elements with fake (or real) content, and refine the smaller elements based on the content.
  4. Finalize the design with further details and make everything fit together as a whole (the gestalt).

This is a similar process to the one used by many painters and other artists. The theory behind this process is to reduce the amount of information you need to manage to only the information that's needed at that stage. For example, there's no point in worrying about colors and fonts if you have no idea where the big blocks of text will go. In practical terms this means:

  1. Layout -- Large blocks divide the page, most likely 4-5 blocks.
  2. First statement -- Contents of each layout block placed as small blocks and visual elements, most likely the layout blocks are invisible now.
  3. Second statement -- Fake (or real) content such as media, lorem ipsum, real copy, text, icons, fonts, and possibly colors.
  4. Third statement -- More small details worked out, but more importantly everything works as a whole, which is called the "gestalt."

A "statement" is another term from painting which means "an attempt at saying what you want for that stage of the work." Each step isn't a final complete step, but rather an attempt to say something, which you'll refine later as you try to "say" more. I like this way of looking at artistic processes because paintings, web pages, and other visual art are a communication medium, and it's usually trying to "state" or "say" something.

The blockstart.css file helps with the Layout and First statement parts of the process by giving you the minimum necessary blocks to create the first statement. There is almost nothing in the CSS, making it easy to replace in later stages...if you want. I actually recommend not keeping the markup and CSS from blockstart.css.


The <block> is the main structure. It's a block. When you put things in it, they stay in there. That's how a block should work:

I am inside a block.

Width and Height

You can set the width and height of a <block> (or immediate children) by simply setting the --w and --h variables:

<block style="--w: 400px; --h: 200px;">400x200 block</block>

That will make a block that's 400px by 200px.


If you just want a block to fill its parent then give it the class .fill. That will probably make it expand to fill, but it's kind of dodgy whether it works as expected. If it's not working then just remove it and use the --h and --w.


Not sure where the boxes are? Add class="debug" to the block (or grid) and it will put a red border around the outer box, then a blue border around the children:

I am inside a block, see it now?

Blocks Propagate

The first children in a block become blocks too. In the beginning that's usually what you want. This means you don't need to put blocks inside blocks unless you want to. You can remove this on an element with class="no-flex":

Line 1

Line 2

No Flex Line 1

No Flex Line 2

In that example, the "No Flex" lines are spaced normally because the code has class="no-flex" on that block.

Block Values and Text

All blocks have a --value variable that sets the backgrond value, and --text for the text value. A "value" is a number 0-9 that indicates the darkness or lightness of an object. Think of it as the amount of light in the object, with 0 meaning no light, and 9 being all the light. Here is a --value: 0; --text: 9;

I am inside a solid block.

Notice how it takes up the whole page width? Notice how it's monochrome? That's all you need. You can change the "value" of a solid block with a variable style="--value: 3":

I am inside a solid dark block.

We can't read that text so we need something called a "Value."


What's a value? A value represents a simple number for the "light" and "dark" of something. Think of it as a measure of the amount of light produced. A value 9 object gives off a lot of light, so it's white. A value 0 object gives off no light, so it's black. You can do most initial designs with only 5 values, but blockstart.css has 10 (0-9) to help with contrast. You can usually change the background with --value: 0 and the text with --text: 9 in most places.

We can fix that last block's contrast with value 9 text using style="--text: 9;":

I am inside a solid dark block too.

If we use style="--value: 0; --text: 9;" we can get a high contast dark block:

I am inside a solid black block.

Values make it easier to solve contrast in your designs because you don't have to think about thousands of colors and their luminance levels. Just make the difference in value between your text (the subject) and background (the ground) to increase contrast. In the previous block the difference was 9 because background is value 0 and text is value 9.

Fixed Values

There are 10 preset values you can use in other CSS settings:

--value0: hsl(0, 0%, calc(0 * var(--value-scale)));
--value1: hsl(0, 0%, calc(1 * var(--value-scale)));
--value2: hsl(0, 0%, calc(2 * var(--value-scale)));
--value3: hsl(0, 0%, calc(3 * var(--value-scale)));
--value4: hsl(0, 0%, calc(4 * var(--value-scale)));
--value5: hsl(0, 0%, calc(5 * var(--value-scale)));
--value6: hsl(0, 0%, calc(6 * var(--value-scale)));
--value7: hsl(0, 0%, calc(7 * var(--value-scale)));
--value8: hsl(0, 0%, calc(8 * var(--value-scale)));
--value9: hsl(0, 0%, calc(9 * var(--value-scale)));

These are useful when you need to set something that's not covered by Blockstart. Say you want to add a bottom-border that's middle gray:

<block style="border-bottom: 1px solid var(--value5);">


For convenience you can just add a class="solid" and get a default gray background with light text.


You always need some kind of rectangle shape to represent where a photo might go, and the shape tag handles that:


You set the shape's size with style="--w: 300px; --h: 300px;".


Just the variable style="--pad: 1rem" to change its padding.


Things need borders and you can add a border with class="border":

This box has a border


Many times in the beginning you'll want to say something is centered, and you mean the whole thing, not just randomly the box but not its content. Add class="center" and it will be centered:

This Block Is Center

You say it's centered, it's centered.

Notice the text isn't centered, because many times you don't want centered text. On landing pages it seems that everything is centered, so you can add center-text to also center the text. You can place this on anything too, not just blocks:

This Text is Center Too

Ok, now it's totally centered.

You can also add class="center-self" on elements that you want to center but not really the contents, and when it's not explicitly a block tag but you want it centered.



By default blocks are vertical, like a web page, because blocks being horizontal by default is stupid. You can make a block horizontal with class="horizontal", and then make it vertical again with class="vertical". Here's a side-by-side block using horizontal:

I'm Left

Everything is set to flex, 'cause that's easier.

I'm Right

That makes doing left and right oriented content that actually contains what it holds easier.


You can add a basic vertical spacing between blocks with <hr> tags. The line is hidden.


You can make a grid, and it'll actually be a grid, that contains its contents. Amazing. Your boxes can also have solid backgrounds or dots, stripes, and lines.

You set the rows, columns, and gap with style variables --rows, --cols, and --gap like so:

<grid style="--rows: auto; --cols: 3; --gap: 1rem;">

Here is that grid setting using blocks inside for each of the patterns:










Stacked Layers

Frequently you need to use multiple layers as in an image with text on top. You might not need this in the layout phase, but in the first statement it does come up. The stack tag will position all of it's children on top of each other in order, and you can set one as the top with class="top".

In this demo I have a block with "I'm on Bottom" that I cover with another block that uses a transparent gray background. This gives the effect of putting a "screen". Remember that these stack in the reverse order you write them, unless you tag one with class="top".

I'm on Bottom

I'm on Top

I put class="debug" around the "I'm on Top" class so you can see where it gets placed. The "top" block has the transparent gray background. The "I'm on Bottom" text is hiding behined it, but looks like it has a gray background. View the source to see what I'm talking about.


If you toss <p> inside a block tag it'll act like any other tags, taking on the block settings. Remember that Blockstart is about big chunky layout blocks, so all you have to do is wrap your content in a regular old <div> and the content will display the way you expect.

Getting Started

Once you download the blockstart.css you need a web server. For people who use Node.js you can run the http-server package to get a simple one. Here's the commands that I use to get a project started:

mkdir myproject
cd myproject
npm init
# Answer all the questions
npm install http-server
mkdir public
npx http-server -d -c-1 public

Once you do that you can place the blockstart.css in the public/ directory and start putting your .html files in the same place. Here's a reasonable starter template:

<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Blockstart Template</title>
  <link rel="stylesheet" href="/blockstart.css">

There's a lot you can add to an HTML page to make it work on different platforms, including all the icons ever invented by Apple, but this file gets you started when using the blockstart.css.