我有一些div,应该是书架上的“书”。所有的div都应该是一个链接,虽然在某些情况下他们会有图像背景,但在某些情况下他们不会。在这种情况下我需要把标题放在一起,好像是一本书,所以文字应旋转90º。我不知道该怎么做,只旋转<a>
内的文字,而不旋转整个div。
<div class="magazinebookcase">
<div class="books">
<a title="Mag1" style="height:286px;width:16px;" href="">Book 1
</a>
</div>
<div class="books">
<a title="Mag2" style="height:258px;width:48px;" href="">Book 2
</a>
</div>
<div class="books">
<a title="Mag3" style="height:252px;width:38px;" href="">
</a>
</div>
<div class="books">
<a title="Mag4" style="height:258px;width:50px;" href="">
</a>
</div>
<div class="books">
<a title="Mag5" style="height:284px;width:14px;" href="">
</a>
</div>
<div class="clearfix"></div>
CSS:
.magazinebookcase {
width: 100%;
padding: 3px;
vertical-align:bottom;
}
.magazinebookcase .clearfix {
clear:both;
}
.magazinebookcase .books {
text-align:center;
display: table-cell;
vertical-align: bottom;
}
.magazinebookcase a {
border: 1px solid #000;
display: block;
word-break: break-all;
}
.magazinebookcase a:hover {
background-color: #ccc;
}
答案 0 :(得分:0)
我希望这会对你有所帮助: -
<强> HTML 强>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="magazinebookcase">
<div class="books">
<a title="Mag1" style="height:286px;width:16px;" href="">Book 1
</a>
</div>
<div class="books">
<a title="Mag2" style="height:258px;width:48px;" href="">Book 2
</a>
</div>
<div class="books">
<a title="Mag3" style="height:252px;width:38px;" href="">
</a>
</div>
<div class="books">
<a title="Mag4" style="height:258px;width:50px;" href="">
</a>
</div>
<div class="books">
<a title="Mag5" style="height:284px;width:14px;" href="">
</a>
</div>
<div class="clearfix"></div>
</div>
</body>
</html>
<强> CSS 强>
.magazinebookcase {
width: 100%;
padding: 3px;
vertical-align:bottom;
}
.magazinebookcase .clearfix {
clear:both;
}
.magazinebookcase .books {
text-align:center;
display: table-cell;
vertical-align: bottom;
border: 1px solid #000;
}
.magazinebookcase a {
display: block;
word-break: break-all;
color: #000;
-moz-transform:rotate(30deg);
}
.magazinebookcase a:hover {
background-color: #ccc;
}
对于每个链接,您将制作不同的课程,这是您的演示..根据您的要求......
答案 1 :(得分:-1)
将内容放在要旋转的范围内,然后可以使用CSS旋转它。例如
<span class="rotate">Book 1</span>
<span class="rotate">Book 2</span>
<span class="rotate">Book 3</span>
<span class="rotate">Book 4</span>
和css
.rotate{
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
}
希望它有效:)