Letter & Word Spacing Demo - Online Typography Control
Adjust letter‑spacing and word‑spacing with a slider and see the effect on a sample paragraph. Copy the CSS.
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.
Adjust letter‑spacing and word‑spacing with a slider and see the effect on a sample paragraph. Copy the CSS.
Design beautiful buttons with gradients, shadows, and hover/active effects. No JavaScript required. Copy the CSS.
Toggle scroll‑behavior: smooth and click anchor links to see the scrolling animation. Implement modern UX.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Build a custom CSS reset by toggling which elements to normalize. Copy the resulting stylesheet. Lean and clean.
Paste CSS with vendor prefixes and get a clean version with only the standard property. Modernize your stylesheets.
Insert a blank line between each line of text. Perfect for blog drafts or scripts. One‑click converter. Local.
Paste or upload an SVG and convert it into a CSS background‑image data URI. Clean and ready to embed.
Pick two colors and mix them in different color spaces with sliders. See the difference between sRGB and OKLCH mixing. Copy the code.
Write CSS like `oklch(from red l c h)` to modify colors. Preview the output and copy. Modern color manipulation.
Pick two images or colors and apply all 16 CSS mix‑blend‑mode values live. See and copy the right CSS for your design.
Set column‑count, gap, and rule, and see a multi‑column text layout. Copy the minimal CSS. For magazine designs.
Pick an emoji and get the exact CSS content property value with escaped Unicode. For inserting emojis via CSS.
Add multiple CSS filters (grayscale, blur, hue‑rotate) to an image. See the combined effect. Copy the CSS filter value.
Type text and instantly see it rendered with text‑transform: uppercase, lowercase, capitalize, and full‑width. Copy CSS.
Write CSS like `oklch(from red l c h)` to modify colors dynamically. Preview the output and copy the code.
Create a multi‑column text layout with adjustable column count, gap, and rule. Copy the CSS. Elegant reading experience.
Convert hex, RGB, or HSL into the modern OKLCH color space. See the preview and copy CSS oklch() value. Local.
Write scoped CSS rules that apply only within a subtree. See the boundary limits and avoid naming conflicts. New browser feature.
Design a fully styled scrollbar with colors, width, radius, and hover effects. Supports both ::-webkit‑scrollbar and Firefox scrollbar‑width.
Set up Stylelint rules for your project by selecting extensions (SCSS, order, etc.). Output a valid .stylelintrc.
Design a custom focus indicator with outline, offset, and box‑shadow. Preview on interactive elements. Copy the CSS.
Write global CSS and auto‑generate unique, scoped class names with source maps. Understand CSS Modules naming.
Add rows and columns, merge cells, and set gaps visually. Get the grid‑template CSS and HTML. Fast layout prototyping.
Build a complete font‑stack for your website. Choose a primary font and get the best fallback options for different OS. Copy the CSS.
Paste code and get a beautifully highlighted preview with line numbers. Supports many languages. Copy as HTML. Pure frontend.
Pick a COLRv1 color font and change its palette with font‑palette. Create custom palettes with @font‑palette‑values.
Construct a CSS‑only carousel with scroll‑snap and scroll‑driven animations. Configurable gap, items, and progress indicator. Copy the HTML/CSS.
Toggle common print styles: remove backgrounds, hide elements, set page margins, and add page breaks. Get the complete @media print block.
Compile LESS code to plain CSS in your browser. Check for syntax errors and get clean output. For legacy projects.