I need to Bring button to the front of Dropdown list in my dropdown button. Even though I have set the z-index:
<div id="dd" class="wrapper-dropdown-5" tabindex="1">BOOK NOW
<ul class="dropdown">
<li>Booking.com</li>
<li>Airbnb</li>
<li>Trip Advisor</li>
</ul>
</div>
https://jsfiddle.net/2pdgc537/6/
-----Edit-------------------------
I don’t need bring down the drop down I need some thing like this https://s27.postimg.org/pqna239sj/sampel.png
You need to change the top position of .wrapper-dropdown-5 .dropdown i.e.,
.wrapper-dropdown-5 .dropdown
{
top : 66%;
}
Here is the working snippet
function DropDown(el) {
this.dd = el;
this.initEvents();
}
DropDown.prototype = {
initEvents: function() {
var obj = this;
obj.dd.on('click', function(event) {
$(this).toggleClass('active');
event.stopPropagation();
});
}
}
$(function() {
var dd = new DropDown($('#dd'));
$(document).click(function() {
// all dropdowns
$('.wrapper-dropdown-5').removeClass('active');
});
});
/* DEMO 5 */
.wrapper-dropdown-5 {
/* Size & position */
position: relative;
width: 200px;
margin: 0 auto;
padding: 12px 15px;
z-index: 10;
/* Styles */
background: #63731b;
border-radius: 50px;
border: 5px solid transparent;
border-color: #ffffff;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
color: white;
font-weight: 600;
cursor: pointer;
outline: none;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.wrapper-dropdown-5:after {
/* Little arrow */
content: "";
width: 0;
height: 0;
position: absolute;
top: 50%;
right: 15px;
margin-top: -3px;
border-width: 6px 6px 0px 6px;
border-style: solid;
border-color: #000000 transparent;
}
.wrapper-dropdown-5 .dropdown {
/* Size & position */
position: absolute;
top: 66%;
left: 0;
right: 0;
z-index: 5;
/* Styles */
background: #63731b;
border-radius: 0 0 5px 5px;
border: 1px solid rgba(0, 0, 0, 0.2);
border-top: none;
border-bottom: none;
list-style: none;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
/* Hiding */
max-height: 0;
overflow: hidden;
}
.wrapper-dropdown-5 .dropdown li {
padding: 0 10px;
}
.wrapper-dropdown-5 .dropdown li a {
display: block;
text-decoration: none;
color: #ffffff;
padding: 10px 0;
transition: all 0.3s ease-out;
/*border-bottom: 1px solid #e6e8ea;*/
}
.wrapper-dropdown-5 .dropdown li:last-of-type a {
border: none;
}
.wrapper-dropdown-5 .dropdown li i {
margin-right: 5px;
color: inherit;
vertical-align: middle;
}
/* Hover state */
.wrapper-dropdown-5 .dropdown li:hover a {
color: #57a9d9;
}
/* Active state */
.wrapper-dropdown-5.active {
border-radius: 40px;
background: #E7B300;
box-shadow: none;
/*border-bottom: none;*/
color: white;
z-index: 10;
}
.wrapper-dropdown-5.active:after {
border-color: #82d1ff transparent;
}
.wrapper-dropdown-5.active .dropdown {
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
max-height: 400px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="row">
<div class="col-sm-4 h-center">
<br/>
<div id="dd" class="wrapper-dropdown-5" tabindex="1">BOOK NOW
<ul class="dropdown">
<li>Booking.com</li>
<li>Airbnb</li>
<li>Trip Advisor</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Add this line in css .dropdown{margin-top:15%;}. Fiddle link is : https://jsfiddle.net/6zw6j97b/
Just edit your css like bolow.
.wrapper-dropdown-5 .dropdown {
/* Size & position */
position: absolute;
top: 80%;
display: block;
left: 0;
right: 0;
z-index: 5;
/* Styles */
background: #63731b;
border-radius: 0 0 5px 5px;
border: 1px solid rgba(0, 0, 0, 0.2);
border-top: none;
border-bottom: none;
list-style: none;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
/* Hiding */
max-height: 0;
overflow: hidden;
}``
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
Can anyone help me with the css, to get this look, i have the html for the dropdown etc. I just need the css for the customization :D
I've re-purposed some code from an old project to give you a start on the functionality you're after
$(function() {
$(document).click(function() {
$('.wrapper-dropdown').toggleClass('active');
});
});
.wrapper-dropdown {
position: relative;
width: 300px;
margin: 0 auto;
padding: 12px 15px;
background: #fff;
box-shadow: 0 1px 0 #c6bba2;
cursor: pointer;
outline: none;
color: #c6bba2;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.wrapper-dropdown:after {
content: "+";
position: absolute;
right: 15px;
color: #c6bba2;
}
.wrapper-dropdown .dropdown {
position: absolute;
top: 100%;
left: 0;
right: 0;
padding: 0;
margin: 0;
background: #fff;
border: 1px solid #c6bba2;
border-top: none;
border-bottom: none;
list-style: none;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
/* Hiding */
max-height: 0;
overflow: hidden;
}
.wrapper-dropdown .dropdown li {
padding: 0 10px;
}
.wrapper-dropdown .dropdown li a {
display: block;
text-decoration: none;
color: #c6bba2;
padding: 10px 0;
transition: all 0.3s ease-out;
border-bottom: 1px solid #c6bba2;
}
.wrapper-dropdown .dropdown li:last-of-type a {
border: none;
}
.wrapper-dropdown .dropdown li i {
margin-right: 5px;
color: inherit;
vertical-align: middle;
}
.wrapper-dropdown .dropdown li:hover a {
color: #57a9d9;
}
.wrapper-dropdown.active {
background: #c6bba2;
box-shadow: none;
border-bottom: none;
color: white;
}
.wrapper-dropdown.active:after {
border-color: #c6bba2 transparent;
}
.wrapper-dropdown.active .dropdown {
border-bottom: 1px solid #c6bba2;
max-height: 400px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="dd" class="wrapper-dropdown" tabindex="1">Size & Fit
<ul class="dropdown">
<li>Size 8</li>
<li>Size 10</li>
<li>Size 12</li>
</ul>
</div>
The more options you add the more you will have to tweak the max height of .wrapper-dropdown.active .dropdown
Hope this helps!
I would like to "draw" an outline around rectangle buttons, meaning I'd like for the border to transition but not fade in. I already have a bunch of effects on these buttons.. I tried to apply an already-made exemple of draw outline CSS but it didn't do anything..
Here's my code
function hoverIcons(classnm) {
document.getElementById(classnm).css({height: '+=30%', width: '+=30%'});
}
function nothoverIcons(classnm) {
document.getElementById(classnm).css({height: '+=30%', width: '+=30%'});
}
#menu {
position: fixed;
bottom: 20;
right: 20;
width: 80;
height: 30px;
background-color: Menu background;
z-index: 10;
}
#mainicons {
position: fixed;
bottom: 20px;
right: 193px;
text-align: center;
}
#mainicons i {
display: inline-block;
margin-top: 0;
margin-left: -3px;
height: 30px;
width: 50px;
padding: 10px;
color-color: Main icon;
background-color: Main icon background;
text-transform: uppercase;
font-size: 15px;
line-height: 30px;
-webkit-transition: all .7s ease;
-moz-transition: all .7s ease;
-o-transition: all .7s ease;
transition: all .7s ease;
}
#mainicons i:hover {
color-color: Hover;
background-color: Main icon;
transform: scale(1.1);
-webkit-transition: all .7s ease;
-moz-transition: all .7s ease;
-o-transition: all .7s ease;
transition: all .7s ease;
}
/*-- BEGINNING BORDER EFFECT (PASTED) --*/
#mainicons {
transition: color 0.25s;
box-sizing: border-box;
}
#mainicons::before, #mainicons::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
#mainicons::before, #mainicons::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
#mainicons::before {
top: 0;
left: 0;
}
#mainicons::after {
bottom: 0;
right: 0;
}
#mainicons:hover {
color: #97c5e0;
}
#mainicons:hover::before, #mainicons:hover::after {
width: 100%;
height: 100%;
}
#mainicons:hover::before {
border-top-color: #97c5e0;
border-right-color: #97c5e0;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
#mainicons:hover::after {
border-bottom-color: #97c5e0;
border-left-color: #97c5e0;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
/*-- BEGINNING BORDER EFFECT (PASTED) --*/
/* originally written in SCSS
#mainicons {
transition: color 0.25s;
box-sizing: border-box;
&::before,
&::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;}
&::before,
&::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
&::before {
top: 0;
left: 0;
}
&::after {
bottom: 0;
right: 0;
}
&:hover {
color: #97c5e0;
}
&:hover::before,
&:hover::after {
width: 100%;
height: 100%;
}
&:hover::before {
border-top-color: #97c5e0;
border-right-color: #97c5e0;
transition:
width 0.25s ease-out,
height 0.25s ease-out 0.25s;
}
&:hover::after {
border-bottom-color: #97c5e0;
border-left-color: #97c5e0;
transition:
border-color 0s ease-out 0.5s,
width 0.25s ease-out 0.5s,
height 0.25s ease-out 0.75s;
}
}
*/
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"/>
<div id="menu">
<div id="mainicons" onmouseover="hoverIcons('mainicons')" onmouseout="nothoverIcons('mainicons')">
<i class="fa fa-home"></i>
<i class="fa fa-envelope"></i>
<i class="fa fa-pencil "></i>
<i class="fa fa-clock-o"></i>
</div>
</div>
I have to admit it's very complicated for me to understand what he/she tried to do for the outline thing (https://codepen.io/giana/pen/yYBpVY).. So if you have a better/easier way to do this, thanks a lot!!
your html seems funny - you have html for a center button and yet none appears??
you can use just 'purple' or 'blue' etc.. for colors if you don't want to use html codes/id you find it easier, you don't need to define these in your css - that dollar sign is usually used in jquery - i haven't seen it used in css before but that's just me, i won't say it can't be used [or i'd stand to be corrected]. EDIT: CSS vars are still experimental technology with no support in Chrome or IE (although supported in edge).. as there's no support in Chrome, I'd hold off using it for now
I adjusted your code somewhat. I added a display:block to the button code so now they display one under the other in the window. Remove this and they will display as the layout will display in your original code. For purposes of snippet/jsfiddle window it's just handier. I replaced the colours with the html colors that you had in your definitions but like i say, in future you can just say border-color:red etc.
Note that this is only meant as a guide. Adjust as you see fit!
button {
display: block;
background: none;
border: 0;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
position: relative;
vertical-align: middle;
&::before,
&::after {
box-sizing: inherit;
content: '';
position: relative;
width: 100%;
height: 100%;
}
}
.draw {
transition: color 0.25s;
border: 2px solid transparent;
height: 100%;
}
.draw::after {
bottom: 0;
right: 0;
}
.draw:hover {
color: #60daaa;
border-color: #fbca67;
width: 100%;
}
.meet {
border-top-color: #fbca67;
border-right-color: #fbca67;
}
.meet::after {
top: 0;
left: 0;
}
.meet:hover {
color: #fbca67;
z-index: 1;
border-bottom-color: #fbca67!important;
border-left-color: #fbca67!important;
}
.center {
width: 200px;
height: 100px;
text-align: center;
padding: 10px;
border-style: solid;
border-top-width: 2px!important;
border-bottom-width: 2px!important;
border-color: #6477b9;
color: #6477b9;
}
.center:hover {
color: #FF0000;
border-left-width: 2px!important;
border-right-width: 2px!important;
z-index: 90!important;
}
.center:focus {
border: 3px dashed red;
color: forestgreen;
}
.spin {
width: 5em;
height: 5em;
padding: 0;
border-width: 2px;
border-style: solid;
border-color: transparent;
top: 0;
left: 0;
}
.circle {
border-radius: 100%;
box-shadow: none;
}
.thick {
color: #f45e61;
z-index: -1;
background: #ffffff;
border-color: #f45e61;
}
.thick:hover {
color: #fff;
font-weight: 700;
background: #f45e61;
}
.thick::after {
mix-blend-mode: color-dodge;
}
/* Page styling */
html {
background: #4b507a;
}
body {
background: #fefefe;
color: #4b507a;
font: 300 24px/1.5 Lato, sans-serif;
margin: 1em auto;
max-width: 36em;
padding: 1em 1em 2em;
text-align: center;
}
.buttons {
isolation: isolate;
}
h1 {
font-weight: 300;
font-size: 2.5em;
}
<!---<h1>CSS Border Transitions</1>-->
<section class="buttons">
<button class="draw">Draw</button>
<button class="draw meet">Draw Meet</button>
<button class="center">Center</button>
<button class="spin">Spin</button>
<button class="spin circle">Spin Circle</button>
<button class="spin thick">Spin Thick</button>
</section>
Fiddle here
oups, i finally understood, effect is actually set on the container and you wish to set it on the links.
You basicly need to update the selector .
example
function hoverIcons(classnm) {
// document.getElementById(classnm).css({height: '+=30%', width: '+=30%'});
}
function nothoverIcons(classnm) {
// document.getElementById(classnm).css({height: '+=30%', width: '+=30%'});
}
#menu {
position: fixed;
bottom: 20;
right: 20;
width: 80;
height: 30px;
background-color: Menu background;
z-index: 10;
}
#mainicons {
position: fixed;
bottom: 20px;
right: 193px;
text-align: center;
}
#mainicons a {
transition: color 0.25s;
display: inline-block;
position: relative;
margin: 0 25px;
padding: 10px 20px;
box-sizing: border-box;
}
a::before,
a::after {
content: '';
position: absolute;
box-sizing: border-box;
width: 100%;
height: 100%;
}
a::before,
a::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
a::before {
top: 0;
left: 0;
}
a::after {
bottom: 0;
right: 0;
}
a:hover {
color: #97c5e0;
}
a:hover::before,
a:hover::after {
width: 100%;
height: 100%;
}
a:hover::before {
border-top-color: #97c5e0;
border-right-color: #97c5e0;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
a:hover::after {
border-bottom-color: #97c5e0;
border-left-color: #97c5e0;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" />
<div id="menu">
<div id="mainicons" onmouseover="hoverIcons('mainicons')" onmouseout="nothoverIcons('mainicons')">
<i class="fa fa-home"></i>
<i class="fa fa-envelope"></i>
<i class="fa fa-pencil "></i>
<i class="fa fa-clock-o"></i>
</div>
</div>
#mainicons a{ /* select here the links */
transition: color 0.25s;
box-sizing: border-box;
display:inline-block;
position:relative ;
margin:0 25px;
padding: 10px 20px;
box-sizing:content-box;
&::before,
&::after {
content: '';
position: absolute;
box-sizing: border-box;
width: 100%;
height: 100%;
}
&::before,
&::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
&::before {
top: 0;
left: 0;
}
&::after {
bottom: 0;
right: 0;
}
&:hover {
color: #97c5e0;
}
&:hover::before,
&:hover::after {
width: 100%;
height: 100%;
}
&:hover::before {
border-top-color: #97c5e0;
border-right-color: #97c5e0;
transition:
width 0.25s ease-out,
height 0.25s ease-out 0.25s;
}
&:hover::after {
border-bottom-color: #97c5e0;
border-left-color: #97c5e0;
transition:
border-color 0s ease-out 0.5s,
width 0.25s ease-out 0.5s,
height 0.25s ease-out 0.75s;
}
}
I want a Button, with 2 elements in it, to slide the Background.
But I want both elements to center vertical and get height 100% even when the other element is bigger.
Here is the HTML
<button class="btn-cstm-slide">
<div class="btn-cstm-slide-logo"><span>Test Test 14343</span></div>
<div class="btn-cstm-slide-text">
<span>Just a Testtest</span>
<br/>
<span>Let's see</span>
</div>
</button>
And here the CSS
.btn-cstm-slide {
height: 100%;
padding: 0px;
display: flex;
position: relative;
text-decoration: none;
overflow: hidden;
background: #333C42;
border: none;
box-shadow: 0px 1px 1px rgba(0,0,0,.1);
}
.btn-cstm-slide-logo {
height:100%;
min-height:100%;
margin: 0;
padding: 10px;
position: relative;
text-decoration: none;
background: #474f54;
color: #fff;
}
.btn-cstm-slide-text {
padding: 10px;
position: relative;
text-decoration: none;
background: #333C42;
color: #fff;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.btn-cstm-slide-text * {
position:relative;
}
.btn-cstm-slide-text:before {
content: "";
position: absolute;
height: 100%;
width: 0;
bottom: 0;
left:0;
background-color: #474f54;
-webkit-transition: all 0.4s ease-in-out 0s;
transition: all 0.4s ease-in-out 0s;
}
.btn-cstm-slide-text:hover:before {
width: 100%;
}
Demo
FIDDLE
Can you help me? :(
Is this what you had in mind?
https://jsfiddle.net/e07uc4kj/9/
.btn-cstm-slide {
height: 100%;
padding: 0px;
display: flex;
position: relative;
text-decoration: none;
overflow: hidden;
background: #333C42;
border: none;
box-shadow: 0px 1px 1px rgba(0,0,0,.1);
}
.btn-cstm-slide-logo {
padding: 10px;
min-width: 80px;
position: absolute;
top: 0px;
bottom: 0px;
text-decoration: none;
background: #474f54;
color: #fff;
vertical-align: middle;
}
.btn-cstm-slide-text {
margin-left: 100px;
padding: 10px;
position: relative;
text-decoration: none;
background: #333C42;
color: #fff;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.btn-cstm-slide-text:before {
content: "";
position: absolute;
height: 100%;
width: 0;
bottom: 0;
left:0;
background-color: #474f54;
-webkit-transition: all 0.4s ease-in-out 0s;
transition: all 0.4s ease-in-out 0s;
}
.btn-cstm-slide-text:hover:before {
width: 100%;
}
I am not sure if this is expected for CSS :after pseudo class.
What do I have ?
I am trying to create a tooltip using CSS. Following is the HTML and CSS I am using. Fiddle HERE
HTML
<div class="tooltip tooltip-left">
:(
</div>
CSS
.tooltip {
display:inline-block;
position:absolute;
background: #002663;
height:100px;
width:300px;
color:#fff;
padding:20px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/*TOP*/
.tooltip-top:after {
content:"";
display: block;
position:absolute;
bottom:-20px;
left:50%;
border-top:20px solid #002663;
border-left:20px solid transparent;
border-right:20px solid transparent;
margin-left:-20px;
};
/*LEFT*/
.tooltip-left:after {
content:"";
display: block;
position:absolute;
right: -20px;
top: 50%;
border-left: 20px solid #002663;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
margin-top: -20px;
};
What's so weird?
The tooltip does not contain the arrow in the current fiddle. However if I comment the class .tooltip-top:after the arrow appears.
Why is this behavior? Cant I declare multiple definitions for :after pseudo element using different classes applied to same element?
You have a trailing semi colon after the .tooltip-top:after class. Remove it. It's causing the next class not to be read.
.tooltip-top:after {
content:"";
display: block;
position:absolute;
bottom:-20px;
left:50%;
border-top:20px solid #002663;
border-left:20px solid transparent;
border-right:20px solid transparent;
margin-left:-20px;
}; /* <-- This ; is what's causing the problem */
UPDATED FIDDLE
CSS:
[data-tips] {
position: relative;
text-decoration: none;
}
[data-tips]:after,
[data-tips]:before {
position: absolute;
z-index: 100;
opacity: 0;
}
[data-tips]:after {
content: attr(data-tips);
height: 25px;
line-height: 25px;
padding: 0 10px;
font-size: 12px;
text-align: center;
color: #fff;
background: #222;
border-radius: 5px;
text-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px rgba(0,0,0,0.3);
-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);
box-shadow: 0 0 5px rgba(0,0,0,0.3);
white-space: nowrap;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
[data-tips]:before {
content: "";
width: 0;
height: 0;
border-width: 6px;
border-style: solid;
}
[data-tips]:hover:after,
[data-tips]:hover:before {
opacity: 1;
}
/* Top tips */
[data-tips].top-tip:after,
[data-tips].top-tip:before {
-webkit-transition: bottom 0.25s ease-in-out, opacity 0.25s ease-in-out;
-moz-transition: bottom 0.25s ease-in-out, opacity 0.25s ease-in-out;
transition: bottom 0.25s ease-in-out, opacity 0.25s ease-in-out;
bottom: 90%;
left: -9999px;
margin-bottom: 12px;
}
[data-tips].top-tip:before {
border-color: #222 transparent transparent transparent;
margin-bottom: 0;
}
[data-tips].top-tip:hover:after,
[data-tips].top-tip:hover:before {
bottom: 100%;
left: 0;
}
[data-tips].top-tip:hover:before {
left: 15px;
}
/* Bottom tip */
[data-tips].bottom-tip:after,
[data-tips].bottom-tip:before {
-webkit-transition: top 0.25s ease-in-out, opacity 0.25s ease-in-out;
-moz-transition: top 0.25s ease-in-out, opacity 0.25s ease-in-out;
transition: top 0.25s ease-in-out, opacity 0.25s ease-in-out;
top: 90%;
left: -9999px;
margin-top: 12px;
}
[data-tips].bottom-tip:before {
border-color: transparent transparent #222 transparent;
margin-top: 0;
}
[data-tips].bottom-tip:hover:after,
[data-tips].bottom-tip:hover:before {
top: 100%;
left: 0;
}
[data-tips].bottom-tip:hover:before {
left: 15px;
}
/* Left tip */
[data-tips].left-tip:after,
[data-tips].left-tip:before {
-webkit-transition: left 0.25s ease-in-out, opacity 0.25s ease-in-out;
-moz-transition: left 0.25s ease-in-out, opacity 0.25s ease-in-out;
transition: left 0.25s ease-in-out, opacity 0.25s ease-in-out;
top: -9999px;
left: 96%;
margin-left: 12px;
}
[data-tips].left-tip:before {
border-color: transparent #222 transparent transparent;
margin-left: 0;
}
[data-tips].left-tip:hover:after,
[data-tips].left-tip:hover:before {
left: 100%;
top: 0;
}
[data-tips].left-tip:hover:before {
top: 7px;
}
/* Right tip */
[data-tips].right-tip:after,
[data-tips].right-tip:before {
-webkit-transition: right 0.25s ease-in-out, opacity 0.25s ease-in-out;
-moz-transition: right 0.25s ease-in-out, opacity 0.25s ease-in-out;
transition: right 0.25s ease-in-out, opacity 0.25s ease-in-out;
top: -9999px;
right: 96%;
margin-right: 12px;
}
[data-tips].right-tip:before {
border-color: transparent transparent transparent #222;
margin-right: 0;
}
[data-tips].right-tip:hover:after,
[data-tips].right-tip:hover:before {
right: 100%;
top: 0;
}
[data-tips].right-tip:hover:before {
top: 7px;
}
HTML :
bavotasan.com
add the data-tips="" parameter to any HTML element plus a class to set the direction and a tooltip will appear.
Try following link :
http://cbavota.bitbucket.org/css3-tips/
So I am making a drop down-menu for my site and all the looks are fine, but when I hover over it, it appears but when I move my mouse over-top it disappears. When I alter the line height under "ul.menu li > a" it works a little but does not solve my problem. I have tried the "z-index" and nothing.
Heres my css:
ul.menu {
display: inline;
padding: 0px;
margin: 0px;
z-index:999;
}
#black_lay {
display:none;
position: absolute; /* makes the div go into a position that’s absolute to the browser viewing area */
left: 0%; /* makes the div span all the way across the viewing area */
top: 0%; /* makes the div span all the way across the viewing area */
background-color: black;
-moz-opacity: 0.7; /* makes the div transparent, so you have a cool overlay effect */
-webkit-opacity: 0.7;
opacity: .70;
filter: alpha(opacity=70);
width: 100%;
height: 100%;
z-index: 90; /* makes the div the second most top layer, so it’ll lay on top of everything else EXCEPT for divs with a higher z-index (meaning the #overlay ruleset) */
}
#overlay {
display: none; /* ensures it’s invisible until it’s called */
position: absolute; /* makes the div go into a position that’s absolute to the browser viewing area */
left: 25%; /* positions the div half way horizontally */
top: 25%; /* positions the div half way vertically */
padding: 25px;
border: 2px solid black;
background-color: #ffffff;
width: 50%;
height: 50%;
z-index: 100; /* makes the div the top layer, so it’ll lay on top of the other content */
}
ul.menu li {
position:relative;
cursor: pointer;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}
ul.menu li.drop {
position: relative;
}
ul.menu > li {
display: inline-block;
}
ul.menu li > a {
line-height: 80px;
padding: 0 1px;
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
.dropOut .triangle {
width: 0;
height: 0;
position: absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid white;
top: -8px;
left: 50%;
margin-left: -8px;
}
.dropdownContain {
width: 160px;
position: absolute;
z-index: 9000000;
left: 50%;
margin-left: -80px; /* half of width */
top: -400px;
}
.dropOut {
width: 160px;
background: white;
float: left;
position: relative;
margin-top: 0px;
opacity: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
.dropOut ul > li {
list-style: none;
}
.dropOut ul {
float: left;
padding: 10px 0;
}
.dropOut ul li {
text-align: left;
float: left;
width: 125px;
padding: 12px 0 10px 15px;
margin: 0px 10px;
color: #777;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: background .1s ease-out;
-moz-transition: background .1s ease-out;
-ms-transition: background .1s ease-out;
-o-transition: background .1s ease-out;
transition: background .1s ease-out;
}
.dropOut ul li:hover {
background: #f6f6f6;
}
ul.menu li:hover a { color: white; }
ul.menu li:hover .dropdownContain { top: 45px; z-index: 500;}
ul.menu li:hover .underline { border-bottom-color: #777; }
ul.menu li:hover .dropOut { opacity: 1; margin-top: 15px; }
Here's my HTML:
<nav style="display:inline">
<ul class="menu">
<li class="drop">
<a>Username</a>
<div class="dropdownContain">
<div class="dropOut">
<div class="triangle"></div>
<ul>
<li>Account</li>
<li>Logout</li>
</ul>
</div>
</div>
</li>
</ul>
</nav>
This should be your problem:
ul.menu li:hover a { color: white; }
It changes the tab's text color to white, as if it's not there.
I changed it to a different color in fiddle and it's working just fine.