Generador CSS Flexbox gratuito
El Generador CSS Flexbox te permite construir un diseño flex visualmente y copiar el CSS generado. Ajusta dirección, ajuste de línea, alineación y espacios, y observa la vista previa actualizarse al instante.
The grid equivalent is the CSS Grid Generator, and the sizing within either comes from the Aspect Ratio Calculator and PX to REM / EM Converter. For the visual properties on the items, the CSS Box Shadow Generator is the companion.
Cómo usar Generador Flexbox
- 1 Choose the flex direction and whether items should wrap.
- 2 Set the main-axis and cross-axis alignment.
- 3 Adjust the gap between items.
- 4 Copy the generated declarations, or inspect the live preview to check the behaviour at different widths.
Cómo usarlo
Elige las propiedades de tu contenedor a la izquierda. La vista previa muestra tres elementos de muestra para que veas cómo responden. Copia el CSS generado cuando estés satisfecho.
- flex-direction, flex-wrap, justify-content, align-items, align-content
- Espacio ajustable entre elementos
- Vista previa en vivo con elementos de muestra
- Copia el CSS generado con un clic
- Se ejecuta enteramente en tu navegador
Preguntas frecuentes
What is the difference between `justify-content` and `align-items`?
`justify-content` distributes items along the main axis, which is horizontal in a row and vertical in a column. `align-items` positions them along the cross axis. Because the axes swap with the direction, the same property has a different visual effect in a row and a column — the single most confusing thing about flexbox.
Why does my flex item refuse to shrink?
Because flex items have a minimum size that defaults to their content size rather than zero. A long unbroken word or a fixed-width child prevents the item from shrinking below that intrinsic width, which causes overflow. Setting the minimum size to zero is the standard fix, and it is the reason flexible layouts with text inside need explicit attention.
When should I use flexbox rather than grid?
Flexbox lays out items along a single axis, distributing space among them, and it handles unknown sizes well because items can grow and shrink. Grid defines a two-dimensional structure of rows and columns and places items into it. Use flexbox for a toolbar or a row of cards, and grid for a page layout or anything where rows must align.
Herramientas para desarrolladores relacionadas
También te puede interesar
Herramientas de otras categorías que suelen combinarse con Generador Flexbox: