滑出面板?

时间:2014-06-08 11:59:56

标签: html css slide out tabslideout

我正在开展一个小项目并且我已将此面板关闭,但我想更改"标签"定位像http://s26.postimg.org/5tr23ln9l/little_text.png这样的东西 我希望你能帮助我,爱,我是一个新手"这里〜

http://jsfiddle.net/2YhzT/

#purple {
-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;
text-align: center;
font-size: 11px;
position:fixed;
left:-50px;
-webkit-transition: all .5s ease-in-out;
-moz-transition: all .5s ease-in-out;
-o-transition: all .5s ease-in-out;
x-index:999;
}


我认为这部分有问题;

2 个答案:

答案 0 :(得分:0)

http://jsfiddle.net/2YhzT/6/

将此添加到#redtab似乎可以解决此问题。

position:relative;
top:-19px;
left:100px;

enter image description here

但是,使用display:inline-block是一种更好的方法。在#redtab上添加:

display: inline-block;
position:absolute;
top:0px;
left:100px;

同时,不要忘记在display:inline-block添加#red

现在,它也适用于窗口调整大小。

enter image description here

再一次

如果您希望它显示和隐藏,如果我按字面意思拍摄您的图像,请执行以下操作:

  1. display:none添加到#redtab(默认情况下,它是隐藏的)
  2. 一旦我们hover超过主要导航元素,我们就可以通过以下方式显示:

    #purple:hover #redtab {
        display: inline-block;
    }
    
  3. 要演示的动画(注意缺少抖动)。

    enter image description here

答案 1 :(得分:0)

Demo

CSS

#purple {
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    text-align: center;
    position:fixed;
    height:10px;
    left:-50px;
    -webkit-transition: all .5s ease-in-out;
    -moz-transition: all .5s ease-in-out;
    -o-transition: all .5s ease-in-out;
    x-index:999;
}
#purple:hover {
    left:0px;
}
#purple:hover > div {
    display: inline-block;
}
#red {
    font-size: 11px;
    background: #FEFEFE;
    border:1px solid;
    border-left:none;
    padding:5px 0 5px 0;
    width:100px;
    height:10px;
    x-index: 50;
}
#redtab {
    -webkit-border-bottom-right-radius: 4px;
    -webkit-border-bottom-left-radius: 0px;
    -moz-border-radius-bottomright: 4px;
    -moz-border-radius-bottomleft: 0px;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 4px;
    border-bottom-left-radius:0px;
    border:1px solid;
    border-left:none;
    text-align: center;
    height:10px;
    padding:5px 0 5px 0;
    width:25px;    
    font-size: 11px;
}


或根据您的图片示例 Demo

CSS

#purple {
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    text-align: center;
    position:fixed;
    height:10px;
}
#purple:hover > div {
    display: inline-block;
}
#red {
    font-size: 11px;
    background: #FEFEFE;
    border:1px solid;
    border-left:none;
    padding:5px 0 5px 0;
    width:100px;
    height:10px;
    x-index: 50;
}
#redtab {
    -webkit-border-bottom-right-radius: 4px;
    -webkit-border-bottom-left-radius: 0px;
    -moz-border-radius-bottomright: 4px;
    -moz-border-radius-bottomleft: 0px;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 4px;
    border-bottom-left-radius:0px;
    border:1px solid;
    border-left:none;
    text-align: center;
    height:10px;
    padding:5px 0 5px 0;
    width:25px;    
    font-size: 11px;
}