CSS overflow Property Demo - Online Scroll & Clip Behavior
See how overflow: visible, hidden, scroll, and auto behave with real content. Clone to test with your text.
UD5 Toolkit
white-space Property Demo
Compare how all 6 white-space values affect text wrapping, spacing, and overflow — all in real time.
white-space: normal
white-space: nowrap
white-space: pre
white-space: pre-wrap
white-space: pre-line
white-space: break-spaces
white-space property in CSS controls how whitespace characters (spaces, tabs, and newlines) are handled inside an element. It determines whether whitespace is collapsed (multiple spaces merged into one), whether lines wrap automatically, and whether newline characters are honored. It's essential for controlling text layout, especially when displaying code blocks, poetry, or preventing unwanted line breaks.
normal — Collapses whitespace, wraps text, ignores newlines (default).nowrap — Collapses whitespace, never wraps, ignores newlines.pre — Preserves all whitespace and newlines, never wraps.pre-wrap — Preserves all whitespace and newlines, wraps when needed.pre-line — Collapses spaces but preserves newlines, wraps when needed.break-spaces — Like pre-wrap, but every space character can be a wrapping point.
normal collapses multiple spaces into a single space and ignores newline characters — text flows as a continuous paragraph. pre-wrap preserves all spaces and newlines exactly as written, while still allowing automatic wrapping at the container edge. Use pre-wrap when you need to preserve formatting (like code or poetry) but still want text to wrap on small screens.
white-space: nowrap when you want to prevent text from wrapping to the next line. Common use cases include: navigation menus (keep all items on one line), table headers, button labels, breadcrumb trails, and any UI element where breaking would look awkward. Be cautious — long text will overflow its container, so pair it with overflow: hidden or text-overflow: ellipsis for clean truncation.
pre-line is a hybrid: it preserves newline characters (like pre) but collapses multiple spaces (like normal), and still allows automatic wrapping. It's ideal for displaying user-submitted content where you want to respect paragraph breaks (newlines) but don't care about preserving exact spacing — such as comment sections, message displays, or formatted text from a <textarea>.
break-spaces is similar to pre-wrap but with one key difference: every individual space character can serve as a line-wrapping opportunity. In pre-wrap, trailing spaces at the end of a line may "hang" (not affect layout). With break-spaces, spaces always take up space and the browser can break at any of them. This is useful for preserving exact whitespace layout while still allowing wrapping in tight containers.
white-space is set to nowrap or pre, text will not break, so it can overflow its container. This is where overflow: hidden, overflow: auto, and text-overflow: ellipsis come into play. For a clean truncated effect, combine: white-space: nowrap; overflow: hidden; text-overflow: ellipsis;. This trio is the classic way to show "..." for overflowing single-line text.
pre-wrap is generally the best choice for displaying code blocks. It preserves indentation and newlines (critical for code readability) while allowing long lines to wrap on small screens. Pure pre can force horizontal scrolling, which is frustrating on mobile. Many code-highlighting libraries use white-space: pre-wrap as their default for responsive code display.
See how overflow: visible, hidden, scroll, and auto behave with real content. Clone to test with your text.
Design beautiful buttons with gradients, shadows, and hover/active effects. No JavaScript required. Copy the CSS.
Style the <progress> and <meter> elements with cross‑browser CSS. Adjust colors and sizes. Copy the final styles.
Pick two images or colors and apply all 16 CSS mix‑blend‑mode values live. See and copy the right CSS for your design.
Write CSS like `oklch(from red l c h)` to modify colors. Preview the output and copy. Modern color manipulation.
Set column‑count, gap, and rule, and see a multi‑column text layout. Copy the minimal CSS. For magazine designs.
Create a multi‑column text layout with adjustable column count, gap, and rule. Copy the CSS. Elegant reading experience.
Pick two colors and mix them in different color spaces with sliders. See the difference between sRGB and OKLCH mixing. Copy the code.
Insert a blank line between each line of text. Perfect for blog drafts or scripts. One‑click converter. Local.
Write CSS like `oklch(from red l c h)` to modify colors dynamically. Preview the output and copy the code.
Build CSS Grid layouts by defining columns, rows, and gaps visually. Get the complete grid CSS code. An essential web design tool running in the browser.
Write modern CSS color functions like oklch(), lab(), hwb() and see the rendered color with fallback. Copy compatible code.
Add multiple CSS filters (grayscale, blur, hue‑rotate) to an image. See the combined effect. Copy the CSS filter value.
Add rows and columns, merge cells, and set gaps visually. Get the grid‑template CSS and HTML. Fast layout prototyping.
Write global CSS and auto‑generate unique, scoped class names with source maps. Understand CSS Modules naming.
Write scoped CSS rules that apply only within a subtree. See the boundary limits and avoid naming conflicts. New browser feature.
Type text and instantly see it rendered with text‑transform: uppercase, lowercase, capitalize, and full‑width. Copy CSS.
Browse a collection of common UI components (cards, modals, navbars) built with pure CSS. Preview and copy the HTML/CSS. Fast prototyping.
Pick an emoji and get the exact CSS content property value with escaped Unicode. For inserting emojis via CSS.
Toggle common print styles: remove backgrounds, hide elements, set page margins, and add page breaks. Get the complete @media print block.
Paste or upload an SVG and convert it into a CSS background‑image data URI. Clean and ready to embed.
Set up Stylelint rules for your project by selecting extensions (SCSS, order, etc.). Output a valid .stylelintrc.
Minify JavaScript and CSS code to reduce file size for production. Remove whitespace and comments instantly. Run locally, your code stays private.
Pick a COLRv1 color font and change its palette with font‑palette. Create custom palettes with @font‑palette‑values.
Visually create beautiful linear and radial gradients. Get the CSS code instantly. Copy the code or export as image. Perfect for web designers.
Convert any length between px, rem, em, vw, vh, %, and pt. Set base size for context. Ultimate frontend helper.
Create gradient‑filled text with the background‑clip property. Choose linear or radial gradients. Get the CSS. Modern typography.
Create circular and elliptical clip paths visually. Adjust radius and position. Copy the CSS. For avatars and masks.
Interactively apply CSS filter functions (blur, brightness, contrast, etc.) to an image and copy the resulting filter property. No coding required.
Compile LESS code to plain CSS in your browser. Check for syntax errors and get clean output. For legacy projects.