Resize Observer Playground - Online Watch Element Size
Drag to resize a box and see the Resize Observer callback fire. Get contentRect and borderBoxSize. Learn the API.
UD5 Toolkit
Real-time monitoring of element size changes using ResizeObserver API
Drag the bottom-right corner to resize, or use the sliders below. Use the sliders below to adjust element size.
window.resize event (which only fires when the entire viewport resizes), ResizeObserver can track size changes on any individual element—even those caused by CSS changes, dynamic content loading, or JavaScript manipulation. It's widely supported in all modern browsers (Chrome 64+, Firefox 69+, Safari 13.1+, Edge 79+).
window.resize only fires when the entire browser viewport changes size. In contrast, ResizeObserver watches individual DOM elements and detects size changes caused by any reason: CSS media queries, flex/grid layout recalculations, content insertion/removal, JavaScript DOM manipulation, or even CSS animations. This granularity makes it ideal for responsive components and dynamic layouts.
setInterval to check dimensions), ResizeObserver uses a callback-based model that fires only when actual size changes occur. The callbacks are batched and delivered in the same microtask, minimizing layout thrashing. For most use cases, the performance impact is negligible. However, avoid performing heavy synchronous work inside the callback—use requestAnimationFrame if you need to defer expensive operations.
observer.unobserve(element) to stop watching a specific element, or observer.disconnect() to stop observing all elements and release the observer entirely. It's good practice to call disconnect() when the observed element is removed from the DOM or when your component unmounts, to prevent memory leaks.
entry.contentRect.width and entry.contentRect.height are sufficient and have the broadest browser support.
Drag to resize a box and see the Resize Observer callback fire. Get contentRect and borderBoxSize. Learn the API.
Make an element resizable horizontally, vertically, or both. See the handle and code. Useful for textareas.
Explore the size‑container and inline‑size CSS properties for container queries. Understand containment contexts. Visual guide.
Compare width/height with block‑size/inline‑size in different writing modes. Understand intrinsic sizing. Copy best practices.
Find out how large you can print based on image resolution in pixels. Understand DPI and megapixels.
Enter megapixels and desired DPI to see the maximum print size without upscaling. Quick quality check.
Enter item dimensions and find the smallest rectangular box that can fit them (simple packing heuristic). Helps reduce shipping costs. Local algorithm.
Calculate the appropriate hide box dimensions based on your reptile’s length and girth. A snug hide reduces stress and promotes natural behavior.
Type a few words and see them rendered at every heading size (h1–h6) with your chosen font. Perfect for design systems.
Enter length, width, thickness to approximate surfboard volume. Compare to your ideal volume based on weight.
Paste a raster image and an SVG, see the file size and rendering time. Understand when to use vector. Local.
Enter baby's weight in lbs or kg to see suggested diaper sizes across major brands. General reference, no data collected.
Apply will‑change to any element and see its effect on compositing. Learn best practices for smooth animations.
Enter two tire sizes and see a side‑by‑side comparison of diameter, width, and speedometer error. Local math.
Enter head circumference to get crown diameter and length. Perfect fit top‑down hats.
Add appliances with running and starting watts to estimate needed generator capacity. Prevent overload.
Estimate your one‑rep max (1RM) from weight and reps. Supports multiple formulas (Epley, Brzycki). Training percentages table.
Enter image pixel dimensions and compute maximum print size at various DPI. With aspect ratio presets (4x6, 5x7, 8x10) and cropping preview. Local tool.
Estimate body fat percentage using neck, waist, hip (if female) measurements. Supports US Navy, Covert Bailey, and 3-site skinfold methods. No data sent to server.
See how scroll‑padding and scroll‑margin affect the position of elements when using anchor links or scroll‑snap. Visual.
Enter your snake's weight and species to get recommended rodent size and feeding frequency. Avoid under/overfeeding.
Select bird species and toy type to see potential hazards and size recommendations.
Interactive guide to understanding standard 16/24 inch stud spacing. Visualize wall internals. Useful before drilling.
Enter viewing distance to get the minimum readable print font size. Design posters and signs.
Demonstrate how to add custom headers and POST‑like functionality to EventSource using a polyfill. Code and example.
Estimate filament usage: enter weight or length and get the remaining value plus cost. PLA/ABS density reference. Local calculation.
Knit a swatch, measure before and after felting, and let this tool calculate the shrink percentage. Plan your felted projects accurately.
Plot weekly weight gain against recommended ranges based on pre-pregnancy BMI. IOM guidelines displayed. Data stored in localStorage.
Generate a Lit Element web component skeleton with styles and properties. Copy and start coding immediately.
Enter current ball size and target to find approx rubber bands required. Fun and satisfying.