0

I'm working on a little project and I have this panel down, but I would like to change the "tab" position something like this http://s26.postimg.org/5tr23ln9l/little_text.png I hope you can help me, loves, I am a bit of a "newbie" here~

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;
}


I think there is something wrong with this part;

2 Answers2

0

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

Adding this to #redtab seems to fix it.

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

enter image description here

However, using an display:inline-block is a better approach. Add this on #redtab:

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

Meanwhile, don't forget to add display:inline-block on #red as well.

Now, it works on window resize too.

enter image description here

One more

If you wanted it to show and hide, if I take your image literally, then do this:

  1. Add display:none to #redtab (So by default it is hidden)
  2. Once we hover over the main navigation element, we can show it by:

    #purple:hover #redtab {
        display: inline-block;
    }
    

Animation to demonstrate (note the lack of jitter).

enter image description here

Ali Gajani
  • 14,762
  • 12
  • 59
  • 100
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;
}


Or this Demo according to your image example

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;
}
4dgaurav
  • 11,360
  • 4
  • 32
  • 59