我更新了jos'demo以使用jQuery来包装每个字母,然后使用Mozilla的转换文档和演示中的示例转换每个字母:
HTML
<div id="skewed">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eu metus nisi.
Integer non adipiscing massa. Etiam et diam magna. Mauris sit amet arcu dui, a
malesuada erat.
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery的
// html function requires jQuery 1.4+
$('#skewed').html(function (i, h) {
h = h.replace(/\s+/g, '\u00a0').split('');
return '<span>' + h.join('</span><span>') + '</span>';
});
Run Code Online (Sandbox Code Playgroud)
CSS
#skewed {
font: 24px Georgia, sans-serif;
background: #ccc;
padding: 10px 20px;
}
#skewed span {
display: inline-block;
/* see https://developer.mozilla.org/en-US/docs/CSS/transform */
-webkit-transform: skewx(20deg);
-o-transform: skewx(20deg);
transform: skewx(20deg);
}
Run Code Online (Sandbox Code Playgroud)
我想这可能就是你要找的东西?jsFiddle
有点代码.否则很确定这是不可能的.您可以在图像编辑软件中执行此操作,例如Paintshop等.
#skewed {
font: 21px Impact, sans-serif;
text-align: center;
background: #ccc
}
#skewed {
width: 350px;
height: 140px;
-moz-transform: skew(-5deg, -5deg);
-o-transform: skew(-5deg, -5deg);
-webkit-transform: skew(-5deg, -5deg);
transform: skew(-5deg, -5deg);
}
Run Code Online (Sandbox Code Playgroud)
<div id="skewed">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eu metus nisi. Integer non adipiscing massa. Etiam et diam magna. Mauris sit amet arcu dui, a malesuada erat.</div>
<!--[if IE]>
<style>
/*
* The following two rules are for IE only and
* should be wrapped in conditional comments.
* The -ms-filter rule should be on one line
* and always *before* the filter rule if
* used in the same rule.
*/
#skewed {
/* IE8+ - must be on one line, unfortunately */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=1,
M12=-0.08748866352592455,M21=-0.08748866352592455, M22=1,
SizingMethod='auto expand')";
/* IE6 and 7 */
filter: progid:DXImageTransform.Microsoft.Matrix(
M11=1,
M12=-0.08748866352592455,
M21=-0.08748866352592455,
M22=1,
SizingMethod='auto expand');
/*
* To make the transform-origin be the middle of
* the object. Note: These numbers
* are approximations. For more accurate results,
* use Internet Explorer with this tool.
*/
margin-left: -9px;
margin-top: -18px;
}
</style>
<![endif]-->?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5288 次 |
| 最近记录: |