CSS Display Generator
Generate CSS display rules — block, inline, inline-block, flex, grid, flow-root, contents, table-cell, none and more — with a live preview, a plain-English explanation of each value and a side-by-side comparison of display: none, visibility: hidden and opacity: 0.
Input
block, inline and inline-block show their effect on the items; flex and grid on the container.
display: none removes the box; visibility: hidden and opacity: 0 keep its space.
Output
Your layout will appear here.
| Property | Value |
|---|---|
| No data yet | |
| Method | Keeps its space | Clickable | Read by screen readers | Child can show itself |
|---|---|---|---|---|
| No data yet | ||||
More ways to use this tool
REST API
curl -X POST https://api.iotools.cloud/v1/tool/css-display-generator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"display": "inline-block",
"target": "items",
"itemCount": "3",
"gap": "12",
"hideMethod": "",
"accentColor": "#6366f1"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `css-display-generator` tool (CSS Display Generator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.
Embed widget
<iframe
src="https://iotools.cloud/embed/css-display-generator/"
width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
title="CSS Display Generator — iotools.cloud"
sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>Drop this into your own page — free, no key required, just a link back.
| Cost per API/MCP call | From 5 credits |
|---|---|
| Need more credits? | View pricing |
Also available with
Guides
See what each CSS display value does
The display property decides what kind of box an element makes and how its children are laid out. This generator applies the value you pick to a sample container or to its items and draws the result live, so you can see the difference between block, inline, inline-block, flex, grid and the rest instead of reading about it. It writes the CSS and HTML for the demo too, ready to copy.
How to use it
- Pick a display value.
- Choose whether to apply it to the items or to the container.
block,inlineandinline-blockare easiest to understand on the items, which sit between two bits of text so you can see whether they share a line.flexandgriddo their work on the container, which then arranges its children. - Change the number of items and the gap to see how the layout reacts.
- Optionally, hide the second item with
display: none,visibility: hiddenoropacity: 0and compare what happens to the space it took up.
Every item is given width: 110px and height: 44px. That's on purpose: with display: inline the size is ignored, which is the most common surprise when styling a span or a link.
What the reference table tells you
- Outer display type: how the box behaves towards its siblings.
blockstarts on a new line and fills the width,inlineflows with the text. - Inner display type: how the box lays out its own children: normal flow,
flow-root,flex,gridortable. - Two-value syntax: the modern equivalent written as outer + inner. For example,
inline-blockisinline flow-rootandinline-flexisinline flex. Current browsers support both forms. - Width and height apply and Starts on a new line, plus a short note on when to use the value.
display: none vs visibility: hidden vs opacity: 0
All three make an element invisible, but they don't behave the same:
| Method | Keeps its space | Clickable | Read by screen readers | Child can show itself |
|---|---|---|---|---|
display: none |
No | No | No | No |
visibility: hidden |
Yes | No | No | Yes, with visibility: visible |
opacity: 0 |
Yes | Yes | Yes | No |
Use display: none to remove something completely, such as a closed menu. Use visibility: hidden when the layout shouldn't jump as the element appears and disappears. Use opacity: 0 for fade transitions, and remember that the invisible element can still be clicked and focused until you also stop that.
When should I use flow-root or contents?
display: flow-root makes a block that contains its floated children and stops margins collapsing through it. It's the modern replacement for the old clearfix hack. display: contents removes the element's own box so its children behave as if they belonged to its parent. That's handy for letting a wrapper's children join a parent grid, but the wrapper's border, background and padding disappear with it.
Going further with flexbox and grid
This tool shows what each display value does. To build a real layout, configure direction, wrapping and alignment in the CSS Flexbox Generator, or define rows, columns and areas in the CSS Grid Generator.