Bug 58965 - CSS transform doesn’t apply to inline elements
Summary: CSS transform doesn’t apply to inline elements
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.6
: P2 Normal
Assignee: Nobody
URL: http://jsfiddle.net/boblet/HY47L/
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-19 23:09 PDT by Oli Studholme
Modified: 2022-09-30 08:50 PDT (History)
9 users (show)

See Also:


Attachments
Demonstration of isolating characters in inline-block so that transforms can be applied (364 bytes, text/html)
2011-06-01 20:55 PDT, Shane Stephens
no flags Details
Demonstration of isolating characters in inline-block so that transforms can be applied (2) (529 bytes, text/html)
2011-06-01 21:12 PDT, Shane Stephens
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oli Studholme 2011-04-19 23:09:15 PDT
The spec says transform should apply to block-level and inline-level elements: http://www.w3.org/TR/css3-2d-transforms/#transform-property
applying a transform:rotate(18deg) to an element with display: inline doesn’t work

Webkit r84295, Chrome 10 and Safari 5.04 fail
Firefox 4 and Opera 11.10 work as expected
Comment 1 Thomas Fuchs 2011-04-19 23:42:30 PDT
Same results on iPad 2, iOS 4.3.2, inline star doesn't rotate.
Comment 2 Dean Jackson 2011-04-20 12:34:44 PDT
See http://www.w3.org/mid/m262qxbr9e.fsf@eoconnor.apple.com
Comment 3 Dean Jackson 2011-04-20 12:35:14 PDT
duh, obviously that's the reason for filing this bug :)
Comment 4 Oli Studholme 2011-04-20 18:32:40 PDT
Thanks for the iOS check Thomas, and the link Dean! Following up from Dean, the relevant text in the link is:
“I propose that CSS Transforms be limited to block-level elements, and inline elements that are never split into multiple boxes (i.e. replaced elements, inline-block and inline-table)”

The spec change mentioned in the link is:
“Applies to: block-level and atomic inline-level elements”
http://dev.w3.org/csswg/css3-2d-transforms/#transform-property

As I should have mentioned the workaround for transforming inline elements is to use display: inline-block;. However, single characters would qualify as atomic, so even in the editor’s draft I still think this is a bug ;)
Comment 5 Shane Stephens 2011-05-18 20:54:31 PDT
From the CSS 2.1 spec (http://www.w3.org/TR/CSS2/visuren.html#inline-boxes):

"An inline box is one that is both inline-level and whose contents participate in its containing inline formatting context. A non-replaced element with a 'display' value of 'inline' generates an inline box. Inline-level boxes that are not inline boxes (such as replaced inline-level elements, inline-block elements, and inline-table elements) are called atomic inline-level boxes because they participate in their inline formatting context as a single opaque box."

<span> is inline-level (display: inline), non-replaced (not an img or embedded document), and therefore an inline box (non-replaced + display: inline). Regardless of whether the content is a single character, <span> is therefore not atomic (it is an inline box). 

So this is not a bug in the editor's draft :)
Comment 6 BrianMB 2011-06-01 20:32:03 PDT
If the spec says that inline elements should not be transformed, then the spec is wrong.

I need to be able to apply transforms to individual letters in the context of words which comply to line wrapping rules.

Setting inline-block on a single letter (or series of letters) screws that up entirely.

Please fix this ASAP (both the draft and Webkit).
Comment 7 Simon Fraser (smfr) 2011-06-01 20:35:57 PDT
(In reply to comment #6)
> If the spec says that inline elements should not be transformed, then the spec is wrong.

Please participate in the discussion on the www-style mailing list if you have feedback on the spec.
Comment 8 Shane Stephens 2011-06-01 20:55:11 PDT
Created attachment 95714 [details]
Demonstration of isolating characters in inline-block so that transforms can be applied
Comment 9 Shane Stephens 2011-06-01 21:02:27 PDT
However, this doesn't work correctly with line wrapping.  There should be a way to make it work though.
Comment 10 Shane Stephens 2011-06-01 21:12:57 PDT
Created attachment 95715 [details]
Demonstration of isolating characters in inline-block so that transforms can be applied (2)

This version wraps the word itself in an inline-block span so that it doesn't break across lines.  I'm pretty sure this is exactly the use case that Brian claims is broken - Brian does this do what you want it to?
Comment 11 Ahmad Saleem 2022-09-30 08:50:23 PDT
I am not able to reproduce this bug in all test cases:

No-wrap example - work same in all browsers (Safari 16, Chrome Canary 108 and Firefox Nightly 107) and show "lifted" as twisted word.

Wrap example - work same in all browsers (Safari 16, Chrome Canary 108 and Firefox Nightly 107) and show "lifted" as twisted word.

JSFiddle - Same across all browsers as well and only one start (light pink) is tilted.

I am marking this as "RESOLVED CONFIGURATION CHANGED" since all browsers now render this same. Please reopen, if this is reproducible or my testing is flawed or I missed something. Thanks!