October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

CSS Logical Properties: A Guide to Writing Direction-Aware Styles

A practical guide to CSS logical properties: understand inline and block axes, map common physical declarations, and write styles that follow text flow.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

CSS logical properties describe layout relative to an element’s writing flow, so margin-inline-start means a margin at the start of the text line—on the left in horizontal LTR and on the right in horizontal RTL. Use them when spacing, sizing, or placement should adapt to writing direction or mode; keep physical properties when a design is intentionally tied to a fixed screen edge.

What are CSS logical properties?

Physical CSS properties name fixed edges or dimensions: left, top, width, and height. Logical properties name positions and dimensions in relation to the content flow: inline-start, inline-end, block-start, block-end, inline-size, and block-size.

The inline axis runs along a line of text; the block axis runs perpendicular to it, in the direction blocks progress. MDN summarizes the distinction as the inline dimension being parallel to text flow and the block dimension perpendicular to it. Neither axis is inherently horizontal or vertical. MDN’s basic concepts guide explains the model.

How do CSS logical properties work with RTL and vertical writing?

The mapping depends on the element’s writing context, shaped by writing-mode, direction, and text-orientation. In broad terms, direction sets the inline base direction, writing-mode sets block-flow direction, and text-orientation affects glyph orientation. Logical properties are therefore not simple aliases for “left” or “top.” See the W3C CSS Writing Modes specification.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Flow-relative intent Horizontal LTR Horizontal RTL Vertical writing
Inline start Left Right At the start of the vertical text line; margin-inline-start can map to top
Block start Top Top At the start of block progression, on a horizontal side
Inline size Extent along the horizontal text line Extent along the horizontal text line Extent along the vertical text line
Block size Extent perpendicular to the text line Extent perpendicular to the text line Extent perpendicular to the vertical text line

In a vertical writing mode, the inline axis becomes vertical and the block axis horizontal. MDN documents margin-inline-start mapping to margin-top in a vertical mode; use the axes rather than memorizing one physical side. MDN’s margins, borders, and padding guide provides usage details.

How do I replace margin-left with a logical property?

First decide what the margin means. If it belongs at the start of the reading line and should flip in RTL, use margin-inline-start. If it must remain on the physical left regardless of writing context, retain margin-left.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
/* Flow-relative: follows the start of the text line. */
.item {
  margin-inline-start: 1rem;
}

/* Physically fixed: always on the left. */
.stuck-to-left-edge {
  margin-left: 1rem;
}

A broad search-and-replace of every left with inline-start is unsafe: first establish whether the design is flow-relative or physically anchored.

Which properties have logical equivalents?

Logical properties cover more than margin and padding. Common families include sizing, borders, insets, and flow-relative values for float, clear, and alignment. The MDN logical properties guide documents the broader set.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Intent Physical example Flow-relative option
Dimension along the text line width inline-size
Dimension perpendicular to the text line height block-size
Margin or padding at inline sides margin-left, padding-right margin-inline-start, padding-inline-end
Border at inline start border-left border-inline-start
Position at a flow-relative edge top, left inset-block-start, inset-inline-start
Alignment relative to flow left or right alignment start or end alignment values where supported by the property

Logical mappings also exist for border radii, float, and clear. Choose the flow-relative form only when the intended relationship is to the writing context.

What is the difference between inline-size and width?

width always describes the physical horizontal dimension. height describes the physical vertical dimension. inline-size describes size along the inline axis, and block-size along the block axis. In horizontal writing, inline-size is usually horizontal; in vertical writing, it is vertical. If a component should retain its sizing relationship to text flow across writing modes, logical sizing expresses that intent.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Build a component with logical spacing and borders

.card {
  inline-size: min(100%, 42rem);
  padding-block: 1rem;
  padding-inline: 1.25rem;
  margin-inline: auto;
  border-inline-start: 0.25rem solid currentColor;
}

Here the card’s extent follows the inline axis, padding is specified along both axes, and its border is at inline-start. In horizontal LTR the border is on the left; in horizontal RTL it moves to the right. These declarations express intent rather than promising any particular physical orientation in every writing mode.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use logical properties for positioned elements when placement follows flow

For an element whose position should track the writing context, use inset-block-start, inset-block-end, inset-inline-start, or inset-inline-end. Keep top, right, bottom, and left when placement is deliberately attached to fixed physical edges, such as a viewport corner.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Do logical properties change four-value shorthands?

No. Four-value shorthands such as margin, padding, and border retain their physical meaning. For example, margin: 1px 2px 3px 4px means top, right, bottom, and left—not block-start, inline-end, block-end, and inline-start. Use logical longhands or axis shorthands such as margin-inline when the sides should follow flow. The MDN guide covers the logical spacing properties.

What happens when physical and logical declarations are mixed?

Corresponding physical and logical properties participate together in the cascade according to the element’s computed writing mode; they are not wholly independent groups. This can make an apparently unrelated change to direction affect which physical side corresponds to a logical declaration. The W3C CSS Logical Properties and Values Level 1 Working Draft, dated 4 December 2025, demonstrates this behavior. A Working Draft is not a final Recommendation.

  • Prefer one clear property model for a component instead of layering physical and logical declarations without a reason.
  • If you need a fallback or override, check declaration order and the element’s computed writing mode, not just the visual result in one LTR layout.
  • Use semantic document markup and appropriate direction settings for bidirectional text; logical properties alone do not solve text ordering.

Do CSS logical properties work in vertical writing modes?

They are designed to express relationships to the writing axes, including vertical writing. Check the intended writing mode and the relevant property mapping rather than assuming that inline means horizontal or block means vertical. MDN’s guides describe the behavior, but the material cited here does not establish a browser-version support matrix; consult a current compatibility reference before setting a specific minimum-browser requirement.

Or skip the browser setup

If you need screenshots to check how a page renders in different writing contexts, ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. Its capture can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before taking the shot; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with the outcome reported in response headers. AI agents can use its take_screenshot, get_page_info, and capture_pdf tools.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

cURL example (replace the target URL as needed; see the ScreenshotNeo API documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo includes 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo, or sign up for the free plan.

How to choose between physical and logical CSS

  • Use logical properties when the design intent follows the text line or block progression, or the component needs to adapt to RTL or vertical writing.
  • Use physical properties when a size or edge is intentionally tied to the horizontal/vertical viewport or another fixed physical reference.
  • Review shorthand and cascade behavior whenever physical and logical declarations coexist.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.