R031: float: left/right on content elements in RTL context without override
A float written for a left-to-right layout keeps its physical side in Arabic, so an image meant to lead the text lands at the end of each line instead.
The check
- Id
- R031
- Category
- Physical CSS
- Default severity
When it fires
medium confidence
The stylesheet shows it was written left-to-right first: the page has an
enorx-defaulthreflang, the sheet uses[dir=ltr]or[dir=rtl]selectors, or different selectors set the same value on opposite sides, such asmargin-lefton one andmargin-righton another. On a right-to-left page, a rule floats a visible elementleftorrightwith no right-to-left override for its selector. In Arabic the float should mirror; as written, content wraps on the wrong side.Fix: Replace float: left or right with float: inline-start or inline-end (verify which edge was intended in LTR).
low confidence
The same float, with nothing on the page saying the sheet was written left-to-right first. It may be the side intended, so it reports at low confidence.
Fix: Replace float: left or right with float: inline-start or inline-end (verify which edge was intended in LTR).
What it leaves alone
Left-to-right pages, floats with a [dir=rtl] counterpart, and boxes 2px or smaller, like the measurement probes scrollbar libraries add, which wrap nothing. Each element is reported once, however many rules float it.
Broken, then fixed
.post img {
float: left;
}.post img {
float: inline-start;
}Check it by hand
Select the element and run getComputedStyle($0).float in the DevTools console. left and right are physical; inline-start and inline-end follow the direction.
What the report shows you
Each R031 finding carries the fields below that apply to it, so you can see why it fired without rerunning the scan.
- cssSelector
- The selector of the rule that sets the float.
- float
leftorright, as the rule sets it.- source
- The stylesheet the rule came from.
- affectedElements
- Up to three visible elements the rule floats on this page.
- ltrFirstEvidence
- What says the sheet was written left-to-right first, or nothing when no signal was found.
Does your page trip R031?
Paste a URL. Ritla renders the page on desktop, tablet and mobile, runs every check, and shows the top issues with screenshot evidence.
Scan a page freeBrowse the checks