我想要一个带有转换的叠加层,如下面的截图
这是我目前的代码:
.someclass {
padding: 5px 5px 5px 5px;
border-radius: 5px 0px 0px 5px;
height: 100px;
width: 30px;
top: 50% !important;
right: 0 !important;
float: right;
position: fixed !important;
transition: width 0.5s;
-webkit-transition: width 0.5s;
text-align: center;
overflow: hidden;
z-index: 100 !important;
color: white;
}
.someclass:hover {
width: 400px;
}

<div class="someclass" style="background-color: #4A90E2;">
<h4 style="transform:rotate(-90deg)" ;>Text</h4>
<h2> Some Text</h2>
<p>much more text</p>
</div>
&#13;
答案 0 :(得分:2)
将你的元素分为两部分,然后左右使用浮点数,使用背景,位置和z-index在崩溃时进行叠加
private String getFixedLengthString(String name, int fixedLength) {
if(name == null) {
name = "";
}
if(name.length() > fixedLength) {
name = name.substring(0, fixedLength);
}
return String.format("%1$-" + fixedLength + "s", name);
}
&#13;
.someclass {
border-radius: 5px 0px 0px 5px;
height: 100px;
width: 30px;
top: 50% !important;
right: 0 !important;
float: right;
position: fixed !important;
transition: width 0.5s;
-webkit-transition: width 0.5s;
text-align: center;
overflow: hidden;
z-index: 100 !important;
color: white;
}
.someclass .right {
float: right;
background: #4A90E2;
width: 30px;
height: 100%;
position: relative;
z-index: 10;
}
.someclass .left {
position: absolute;
left: 0;
float: left;
}
.someclass:hover {
width: 400px;
}
&#13;