我是 css 变换旋转的新手,想知道如何让它在其父元素中使用绝对定位。有人可以帮忙吗?
这是一个测试片段,主要是我想要的,但旋转的文本显示在错误的位置。我希望它位于 foo、bar1 和 bar2 气泡的左侧填充区域。
<html>
<head>
<style type="text/css">
div.item {
display: block;
border: 1px solid #888;
border-radius: 5px;
padding: 2px 15px;
}
span.rotated {
display: block;
position: absolute;
left: 0px;
bottom: 0px;
font-family: Verdana, sans-serif;
font-size: smaller;
-ms-transform:rotate(270deg); /* IE 9 */
-moz-transform:rotate(270deg); /* Firefox */
-webkit-transform:rotate(270deg); /* Safari and Chrome */
-o-transform:rotate(270deg); /* Opera */
}
</style>
</head>
<body>
<div class="item">foo<span class="rotated">foodoo the voodoo</span>
<div class="item">bar1<span class="rotated">bar bar bar bar Barbara Ann</span>
<div class="item">baz1</div>
<div class="item">baz2</div>
<div class="item">baz3</div>
<div class="item">baz4</div>
<div class="item">baz5</div>
<div class="item">baz6</div>
</div>
<div class="item">bar2<span class="rotated">Barber of Seville</span>
<div class="item">baz7</div>
<div class="item">baz8</div>
<div class="item">baz9</div>
<div class="item">baz10</div>
<div class="item">baz11</div>
<div class="item">baz12</div>
</div>
</div>
</body>
</html>