I'm baffled by this one. I want to apply a CSS skew transform to the <li>'s in a horizontal menu of links. And the code I've written works (the skew is applied) in three of the five latest browsers: FF, IE9, and Opera -- but not Chrome or Safari!?!
Here is an example of the test HTML:
And here is the CSS:Code:<!DOCTYPE HTML> <html> <head> <title>Skew Test</title> <link rel="stylesheet" href="test.css" type="text/css" /> </head> <body> <nav> <ul> <li> <a href="#">link 1</a> </li> <li> <a href="#">link 2</a> </li> <li> <a href="#">link 3</a> </li> </ul> </nav> <nav> <ul> <li class="skewed"> <a href="#">link 1</a> </li> <li class="skewed"> <a href="#">link 2</a> </li> <li class="skewed"> <a href="#">link 3</a> </li> </ul> </nav> </body> </html>
As I said, this works for me -- the <li>'s all skew properly -- in 3 browsers, but not in the ones that were first to come out with CSS transformations (Webkit)!Code:nav { display:block; margin:15px; padding:15px; height:100px; } ul { list-style-type:none; margin:25px 0px; padding:0; } li { display:inline; background:#0C3; width: 30px; height:50px; margin: 15px 5px; padding:10px 10px; border:#F03 thick solid; } .skewed { /* skew the object horizontally by 20 degrees clockwise */ -moz-transform: skew(-20deg, 0deg); -ms-transform: skew(-20deg, 0deg); -o-transform: skew(-20deg, 0deg); -webkit-transform: skew(-20deg, 0 deg); transform: skew(-20deg, 0 deg); }
What in the world am I doing wrong? Where is the bug in my css?


Reply With Quote


Thank you! That got it - and taught me something I didn't know (that dimensions are not applied to inline li elements).

Bookmarks