I am trying to make a hover open div with css. I created it but i have one question about hover position left and right.
First of all sorry for my english.
I created this DEMO from Codepen.
My question is: If you check my demo page you see information and location icon. When you hover over information or location icon then you see bubble div. in the upper left corner of the nice parts. but if you hover over information or location on the right side then you see bubble carry out.
I don't want to carry out bubble. I want to make a bubble stay in main div inside. What should i do for this ? Anyone can help me here ?
Here is my HTML code:
<div class="ssss">
<div class="s_u_a">
<div class="user_p_c_p">
<img src="1.jpg">
</div>
<div class="user_p_p_p">
<img src="2.jpg">
</div>
<div class="u_l_inf">
<div class="u_l_"><div class="uynott">test</div></div>
<div class="u_inf_"><div class="uynott2">test</div></div>
</div>
<div class="u_p_n_">test</div>
<div class="u_p_n_s">test</div>
</div>
</div>
in this html code main div is .sss
and this is my css code for bubble:
.u_l_:hover .uynott {
position:relative;
opacity:1;
visibility:visible;
transition: opacity .5s linear .5s;
-webkit-transition: opacity .5s linear .5s;
-moz-transition: opacity .5s linear .5s;
-ms-transition: opacity .5s linear .5s;
}
.uynott
{
font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;
font-size:12px;
position: relative;
width: 295px;
height: auto;
padding: 10px;
background-color:#5890ff;
color:#fff;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border: #5890ff solid 1px;
visibility:hidden;
line-height: 21px;
margin-left: -25px;
opacity:0;
margin-top:25px;
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
z-index:5;
}
.uynott:after
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 1;
top: -8px;
left: 20px;
}
.uynott:before
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 0;
top: -9px;
left: 20px;
}
.u_inf_:hover .uynott2 {
position:relative;
opacity:1;
visibility:visible;
transition: opacity .5s linear .5s;
-webkit-transition: opacity .5s linear .5s;
-moz-transition: opacity .5s linear .5s;
-ms-transition: opacity .5s linear .5s;
}
.uynott2
{
font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;
font-size:12px;
position: relative;
width: 295px;
height: auto;
padding: 10px;
background-color:#5890ff;
color:#fff;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border: #5890ff solid 1px;
visibility:hidden;
line-height: 21px;
margin-left: -115px;
opacity:0;
margin-top:25px;
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
z-index:5;
}
.uynott2:after
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 1;
top: -8px;
left: 115px;
}
.uynott2:before
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 0;
top: -9px;
left: 115px;
}
TBH... you just have to make another class for your divs at the right and move the div hidden before hover.
here you have your code working: http://codepen.io/anon/pen/bDrwk
code
Just have a look at the changes I made and you will easily see what you had to do. won't copy all the code as it will be as long as yours (even longer) and a bit confusing I move also the little arrow of your bubble.
Just remove width:295px from the class .uynott2 and check the output!!
Related
I am trying to have a corner button display new content on hover using the following setup:
<div class="panel panel-default1">
<div class="panel-body">
<div class='amg-corner-button_wrap'>
<div class="overlay"></div>
<div class="overlay-content">
<h2>Image Ink Logo</h2>
<p>Logo for a screen printing company. They wanted a detachable/recognizable brand that didn't need the name of the company.</p>
</div>
</div> <!-- wrap -->
</div> <!-- panel body -->
</div> <!-- panel default -->
CSS:
.panel-default1 {
padding-top: 10px;
border-radius: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.10);
height: 400px;
width: 100%;
overflow: hidden;
margin: 0 auto;
position: relative;
}
.amg-corner-button_wrap {
display: block;
position: absolute;
bottom: 0;
right: 0;
width: 40px;
height: 40px;
}
.amg-corner-button_wrap .overlay {
border-bottom: 40px solid #e8c63d;
border-left: 40px solid transparent;
bottom: 0;
height: 0;
opacity: .95;
position: absolute;
right: 0;
text-indent: -9999px;
-moz-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
-webkit-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
width: 0;
}
.amg-corner-button_wrap:hover .overlay {
border-bottom: 800px solid #e8c63d;
border-left: 800px solid transparent;
-moz-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
-webkit-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
}
.amg-corner-button_wrap .overlay-content {
bottom: 0;
color: #333;
left: 0;
opacity: 0;
padding: 30px;
position: absolute;
right: 0;
top: 0;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.amg-corner-button_wrap .overlay-content h2 {
border-bottom: 1px solid #333;
padding: 0 0 12px;
}
.amg-corner-button_wrap:hover .overlay-content {
opacity: 1;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
-moz-transition-delay: 0.3s;
-o-transition-delay: 0.3s;
-webkit-transition-delay: 0.3s;
transition-delay: 0.3s;
}
Here is fiddle : https://jsfiddle.net/ar3jkuvq/
The hover deployment works well but the .overlay-content text does not show up if .amg-corner-button_wrap uses position: absolute. However I need it to keep the hover on the wrap only.
How can I keep the hover effect on the wrap only and show the text content at the same time?
You can use CSS3 transform property to scale the overlay instead of using a border, and then use a General sibbling combinator [w3] selector ~ to select the .overlay-content element that is preceded by a .amg-corner-button_wrap:hover.
Working fiddle
add this class in your css
.amg-corner-button_wrap{
width:100%;
height:100%;
}
I believe you can make use of the pointer-events attribute here.
Remove position: absolute; from .amg-corner-button_wrap
Add pointer-events: none; to .panel-default1
Add pointer-events: all; to .amg-corner-button_wrap .overlay
Working JSFiddle
I have something like this "http://jsfiddle.net/sogpgepg/" that works on Chrome and on Firefox. However I noticed the offset doesn't work on Internet Explorer and the outline is outside the picture and not inside it.
After some research I found out that Explorer doesn't support outline-offset!
Is there any way I can get the same effect (inside border) on Internet Explorer?
Script:
HTML
<div id="container">
<div class="inner">
<img src="http://hostingride.com/wp-content/uploads/2014/07/microsoft_xp_bliss_desktop_image-650x0.jpg"/>
</div>
</div>
CSS
#container{
width: 300px;
height: auto;
margin: 0;
padding: 0;
}
.inner img{
width: 100%;
outline: 6px solid RGBa(255,0,0, 0.5);
outline-offset: -6px;
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
}
.inner img:hover {
outline: 6px solid rgba(200,200,200,0);
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
}
Here is an alternate for IE as shown in "http://css-tricks.com/"
Code:
<div class="inner-border">
Transparent Inside Border
</div>
CSS
.inner-border {
background: #000;
color: #fff;
margin: 50px;
padding: 15px;
position: relative;
}
.inner-border:before {
border: 5px solid #000;
content: "";
position: absolute;
top: -10px;
bottom: -10px;
left: -10px;
right: -10px;
}
JSFiddle Demo of the Above Code
Here is another example of Transparent Inside Border:
http://jsfiddle.net/chriscoyier/DvaqK/4/
Hope this will help!
One possible work around is to use an inset shadow.
I modified your fiddle somewhat.
http://jsfiddle.net/sogpgepg/1/
The changes I made are:
Make the <img> a background-image on .inner.
Move all styles from .inner img up to .inner
By setting the blur radius to 0 and specifying the spread radius, you can get a hard-edge 'border'.
This link includes more information on using shadows (particularly inset shadows): http://designshack.net/articles/css/inner-shadows-in-css-images-text-and-beyond/
Code:
#container {
width: 300px;
height: auto;
margin: 0;
padding: 0;
}
.inner{
width: 300px;
height:200px;
background-image:url('http://hostingride.com/wp-content/uploads/2014/07/microsoft_xp_bliss_desktop_image-650x0.jpg');
box-shadow:inset 0px 0px 0px 6px rgba(255,0,0,0.5);
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
}
.inner:hover {
box-shadow: inset 0px 0px 0px 6px rgba(200,200,200,0);
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
}
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/
i have a code HTML CODE:
<div class="wrapper-demo">
<div id="dd" class="wrapper-dropdown-2" tabindex="1">Sign in with
<ul class="dropdown">
<li><i class="icon-twitter icon-large"></i>Twitter</li>
<li><i class="icon-github icon-large"></i>Github</li>
<li><i class="icon-facebook icon-large"></i>Facebook</li>
</ul>
</div>
</div>
AND CSS:
.wrapper-dropdown-2 {
position: relative;
width: 200px;
margin: 0 auto;
padding: 10px 15px;
background: #fff;
border-left: 5px solid orange;
cursor: pointer;
text-align: left;
cursor: pointer;
outline: none;
}
.wrapper-dropdown-2:after {
content: "";
width: 0;
height: 0;
position: absolute;
right: 16px;
top: 50%;
margin-top: -3px;
border-width: 6px 6px 0 6px;
border-style: solid;
border-color: grey transparent;
}
.dropdown {
display:none;
}
.wrapper-dropdown-2:hover ul.dropdown {
position: absolute;
display:block;
top: 100%;
left: -5px;
right: 0px;
background: white;
-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;
list-style: none;
opacity: 0;
pointer-events: none;
}
.wrapper-dropdown-2 .dropdown li a {
display: block;
text-decoration: none;
color: #333;
border-left: 5px solid;
padding: 10px;
-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;
}
http://jsfiddle.net/pvt3e/
and i try, in hover mouse to: Sign in with open the drop down but its not work !
i cant work with js. Because I have a problem with 1.8.2, but I think we can find a solution with CSS
try this
.wrapper-dropdown-2:hover ul{
display:block;
}
updated jsFiddle File
also remove .dropdown:hover from your style
You are missing to add hover code to see drop down when hover over. add css for hover.
.wrapper-dropdown-2:hover .dropdown
{
display:block;
}
Live Demo
Just Replace Your This CSS
.dropdown:hover {
/* Size & position */
position: absolute;
display:block;
top: 100%;
left: -5px;
right: 0px;
/* Styles */
background: white;
-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;
list-style: none;
/* Hiding */
opacity: 0;
pointer-events: none;
}
To My CSS and Get Result
.wrapper-dropdown-2:hover > .dropdown {
position: absolute;
display:block;
left: -45px;
background: white;
top:24px;
}
You will need to initialize your javascript as well as link to jquery. I see you are using a dropdown from Codrops why dont you just download the source?
The arrows before the title are displayed using a :before. The problem only occur on Internet Explorer.
// edit : Mistake there, my styling is on p a.
Maybe is it the issue ?
So, here's the code:
.special-title {
font-size: 24px;
color: #a4a19e;
line-height: 1.2;
position: relative;
padding: 8px 0 8px 38px;
border-top: 1px solid #e2dbcf;
border-bottom: 1px solid #e2dbcf;
margin-top: 49px;
margin-bottom: 25px; }
.special-title:before {
content: url('../img/general-title-decoration.svg?1369571463');
position: absolute;
width: 28px;
left: 0;
top: 23px;
margin-top: -13px; }
and for the button:
.btn-call-to-action a {
background: #8e8287;
color: #f5f3e2;
padding: 2px 60px 2px 10px;
height: 35px;
line-height: 40px;
margin-top: 6px;
display: inline-block;
position: relative;
border-radius: 2px;
height: 40px;
white-space: nowrap;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; }
.btn-call-to-action a:hover:after {
-webkit-transform: translatex(6px);
-moz-transform: translatex(6px);
-o-transform: translatex(6px);
-ms-transform: translatex(6px);
transform: translatex(6px); }
.btn-call-to-action a:hover {
background: #6f6469;
border-bottom: none; }
.btn-call-to-action a:after {
content: url('../img/general-white-arrow.svg?1369574895');
position: absolute;
width: 35px;
right: 15px;
top: 0px;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; }
and here's the live site: http://aurelieremia.be/tfa/
In .special-title:before, since you're using absolute positioning, remove
margin-top:-13px;
and just use
top:10px;
instead. Then, declare a height as well as a width.
see http://jsfiddle.net/6TdB6/