Skip to main content

CSS Display Generator

API reference

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.

What this value does
PropertyValue
No data yet
Ways to hide an element
MethodKeeps its spaceClickableRead by screen readersChild can show itself
No data yet
display declaration
 
CSS
 
HTML
 
Was this helpful?

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_HERE

Paste 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 callFrom 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

  1. Pick a display value.
  2. Choose whether to apply it to the items or to the container. block, inline and inline-block are easiest to understand on the items, which sit between two bits of text so you can see whether they share a line. flex and grid do their work on the container, which then arranges its children.
  3. Change the number of items and the gap to see how the layout reacts.
  4. Optionally, hide the second item with display: none, visibility: hidden or opacity: 0 and 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. block starts on a new line and fills the width, inline flows with the text.
  • Inner display type: how the box lays out its own children: normal flow, flow-root, flex, grid or table.
  • Two-value syntax: the modern equivalent written as outer + inner. For example, inline-block is inline flow-root and inline-flex is inline 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.

display propertyinline-blockflow-rootdisplay nonevisibility hiddenhide elementblock vs inlinelayoutbox model

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.