tool tip without mouse hover - html

I created an inline help tip using http://tutorialzine.com/2014/07/css-inline-help-tips/ based on html css.Below given code works on mouse hover on help icon it shows some text but what i need is automatically show the mouse hover text that is "hello pls help" with out mouse hover i need the mouse hover information to show automatically once the page loads.Thanks in advance
.help-tip{
position: absolute;
top: 18px;
right: 18px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip:hover p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p{ /* The tooltip */
display: none;
text-align: left;
background-color: #1E2021;
padding: 20px;
width: 200px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip p:before{ /* The pointer of the tooltip */
position: absolute;
content: '';
width:0;
height: 0;
border:6px solid transparent;
border-bottom-color:#1E2021;
right:10px;
top:-12px;
}
.help-tip p:after{ /* Prevents the tooltip from being hidden */
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
/* CSS animation */
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
<div class="help-tip">
<p id="helpinforchart">hello pls help</p>
</div>

Remove the display:none from the css as below
.help-tip{
position: absolute;
top: 18px;
right: 18px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip:hover p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p{ /* The tooltip */
text-align: left;
background-color: #1E2021;
padding: 20px;
width: 200px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip p:before{ /* The pointer of the tooltip */
position: absolute;
content: '';
width:0;
height: 0;
border:6px solid transparent;
border-bottom-color:#1E2021;
right:10px;
top:-12px;
}
.help-tip p:after{ /* Prevents the tooltip from being hidden */
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
/* CSS animation */
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
<div class="help-tip">
<p id="helpinforchart">hello pls help</p>
</div>

simply add display:block in place of display:none
.help-tip p
{
display:block;
}

Removing properties from .help-tip:hover will help you
.help-tip{
position: absolute;
top: 18px;
right: 18px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip p{ /* The tooltip */
text-align: left;
background-color: #1E2021;
padding: 20px;
width: 200px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p:before{ /* The pointer of the tooltip */
position: absolute;
content: '';
width:0;
height: 0;
border:6px solid transparent;
border-bottom-color:#1E2021;
right:10px;
top:-12px;
}
.help-tip p:after{ /* Prevents the tooltip from being hidden */
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
/* CSS animation */
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
<div class="help-tip">
<p id="helpinforchart">hello pls help</p>
</div>

hume
You can change css like:
/* add 'active' class behavior */
.help-tip:hover p,
.help-tip.active p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
and change html like:
<!-- add 'active' class -->
<div class="help-tip active">
<p id="helpinforchart">hello pls help</p>
</div>
if you want to change the operation behavior to 'hover show', add js like:
// native
var tip = document.getElementsByClassName('help-tip')[0];
tip.className = tip.className.replace('active', '');
// jQuery
$('.help-tip').removeClass('active')

If you're willing to add some javascript this jQuery code and .display class keep the hover functionality and display the tooltip on document load:
Css:
.display {
display: block !important;
}
jQuery (loaded on the document ´< head>´):
$(window).load(function(){
$('#helpinforchart').addClass('display');
$('.help-tip').mouseleave(function(){
$('#helpinforchart').removeClass('display');
$(this).unbind();
})
});
To see it working see this fiddle: https://jsfiddle.net/r80o6ej8/

Related

How to animate/style like transition to border-bottom? [duplicate]

I'm trying to get a transition hover effect on border that the border expands on hover.
h1 {
color: #666;
}
h1:after {
position: absolute;
left: 10px;
content: '';
height: 40px;
width: 275px;
border-bottom: solid 3px #019fb6;
transition: left 250ms ease-in-out, right 250ms ease-in-out;
opacity: 0;
}
h1:hover:after {
opacity: 1;
}
<h1>CSS IS AWESOME</h1>
I've tried this on Jsfiddle
To expand the bottom border on hover, you can use transform:scaleX'(); (mdn reference) and transition it from 0 to 1 on the hover state.
Here is an example of what the border hover effect can look like :
The border and transition are set on a pseudo element to prevent transitioning the text and avoid adding markup.
To expand the bottom border from left or right, you can change the transform-origin property to the left or right of the pseudo element:
h1 { color: #666;display:inline-block; margin:0;text-transform:uppercase; }
h1:after {
display:block;
content: '';
border-bottom: solid 3px #019fb6;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
h1:hover:after { transform: scaleX(1); }
h1.fromRight:after{ transform-origin:100% 50%; }
h1.fromLeft:after{ transform-origin: 0% 50%; }
<h1 class="fromCenter">Expand from center</h1><br/>
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
Note : You need to add vendor prefixes to maximize browser support (see canIuse).
Expand bottom border on hover with 2 lines
You can achieve this effect when the text spans on 2 lines. The before pseudo element is absolutely positioned to make underline of the first line with bottom:1.2em;:
h1 { position:relative;color: #666;display:inline-block; margin:0;text-transform:uppercase;text-align:center;line-height:1.2em; }
h1:after, h1:before {
display:block;
content: '';
border-bottom: solid 3px #019fb6;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
h1:before{
position:absolute;
bottom:1.2em; left:0;
width:100%;
}
.ef2:hover:after {
transition-delay:150ms;
}
h1:hover:after, h1:hover:before { transform: scaleX(1); }
<h1>Expand border<br/>on two lines</h1>
<br/>
<br/>
<h1 class="ef2">Expand border<br/>effect two</h1>
Different transition direction on hover in and out :
The point is to change the transform-origin position from one side to the other on the hover state. This way the bottom boder enters from one side on hover and exits on the other when the element isn't hovered anymore.
Here is a demo :
h1 { color: #666;display:inline-block; margin:0;text-transform:uppercase; }
h1:after {
display:block;
content: '';
border-bottom: solid 3px #019fb6;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
h1.fromLeft:after{ transform-origin: 100% 50%; }
h1.fromRight:after{ transform-origin: 0% 50%; }
h1.fromLeft:hover:after{ transform: scaleX(1); transform-origin: 0% 50%; }
h1.fromRight:hover:after{ transform: scaleX(1); transform-origin: 100% 50%; }
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
We can do this with only background. No pseudo-element needed. This is more flexible.
h1 {
/* you can change these variables to control the border */
--border-color: purple;
--border-width: 5px;
--bottom-distance: 0px; /* you can increase this */
color: #666;
display: inline-block;
background-image: linear-gradient(var(--border-color), var(--border-color));
background-size: 0% var(--border-width);
background-repeat: no-repeat;
transition: background-size 0.3s;
margin: 5px 0;
}
.fromCenter {
background-position: 50% calc(100% - var(--bottom-distance));
}
.fromRight {
background-position: 100% calc(100% - var(--bottom-distance));
}
.fromLeft {
background-position: 0 calc(100% - var(--bottom-distance))
}
h1:hover {
background-size: 100% var(--border-width);
}
<h1 class="fromCenter">Expand from center</h1><br/>
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
Multiple line animation:
h1 {
/* you can change these variables to control the border */
--border-color: purple;
--border-width: 5px;
--bottom-distance: 0px; /* you can increase this */
color: #666;
display: inline; /* should be 'inline' for multiple line animation */
background-image: linear-gradient(var(--border-color), var(--border-color));
background-size: 0% var(--border-width);
background-repeat: no-repeat;
transition: background-size 0.5s;
}
.fromCenter {
background-position: 50% calc(100% - var(--bottom-distance));
}
.fromRight {
background-position: 100% calc(100% - var(--bottom-distance));
}
.fromLeft {
background-position: 0 calc(100% - var(--bottom-distance))
}
h1:hover {
background-size: 100% var(--border-width);
}
<h1 class="fromLeft">Expand from <br>left with <br>multiple line</h1>
simple and lightweight version
li {
margin-bottom: 10px;
}
.cool-link {
display: inline-block;
color: #000;
text-decoration: none;
}
.cool-link::after {
content: '';
display: block;
width: 0;
height: 2px;
background: #000;
transition: width .3s;
}
.cool-link:hover::after {
width: 100%;
//transition: width .3s;
}
<ul>
<li><a class="cool-link" href="#">A cool link</a></li>
<li><a class="cool-link" href="#">A cool link</a></li>
<li><a class="cool-link" href="#">A cool link</a></li>
</ul>
I know this is an old post and it is already answered but you might like the following effect too.
<div class="cd-single-point">
<a class="cd-img-replace" href="#0"></a>
</div>
.cd-single-point {
position: absolute;
list-style-type: none;
left: 20px;
top: 20px;
}
.cd-single-point>a {
position: relative;
z-index: 2;
display: block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #0079ff;
-webkit-transition: background-color 0.2s;
-moz-transition: background-color 0.2s;
-o-transition: background-color 0.2s;
transition: background-color 0.2s;
}
.cd-single-point::after {
content: '';
position: absolute;
border-radius: 50%;
width: 100%;
height: 100%;
top: 0;
left: 0;
animation: cd-pulse 2s infinite;
}
#keyframes cd-pulse
{
0% {box-shadow:0 0 0 0 #0079ff}
100%{box-shadow:0 0 0 20px rgba(255,150,44,0)}
}
DEMO
h1 {
color: #666;
display:inline-block;
margin:0;
text-transform:uppercase;
}
h1:after {
display:block;
content: '';
border-bottom: solid 3px #92a8d1;
transform: scaleX(0);
transition: transform 800ms ease-in-out;
}
h1:hover:after {
transform: scaleX(1);
}
<h1 class="fromCenter">Hover Over Me</h1><br/>
we can do using simple transition effect.
HTML
<h1>CSS IS AWESOME</h1>
CSS
h1 {
color: #666;
position: relative;
display: inline-block;
}
h1:after {
position: absolute;
left: 50%;
content: '';
height: 40px;
height: 5px;
background: #f00;
transition: all 0.5s linear;
width: 0;
bottom: 0;
}
h1:hover:after {
width: 270px;
margin-left: -135px;
}
Link to Fiddle
h1 {
/* you can change these variables to control the border */
--border-color: purple;
--border-width: 5px;
--bottom-distance: 0px; /* you can increase this */
color: #666;
display: inline-block;
background-image: linear-gradient(var(--border-color), var(--border-color));
background-size: 0% var(--border-width);
background-repeat: no-repeat;
transition: background-size 0.3s;
margin: 5px 0;
}
.fromCenter {
background-position: 50% calc(100% - var(--bottom-distance));
}
.fromRight {
background-position: 100% calc(100% - var(--bottom-distance));
}
.fromLeft {
background-position: 0 calc(100% - var(--bottom-distance))
}
h1:hover {
background-size: 100% var(--border-width);
}
<h1 class="fromCenter">Expand from center</h1><br/>
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
transition: all 1000ms ease-in-out;
Demo
or are you looking for this
Demo2
h1 {
color: #666;
}
h1:after {
position: absolute;
left: 10px;
content: '';
height: 40px;
width: 275px;
border-bottom: solid 3px #019fb6;
transition: all 550ms ease-in-out;
border-bottom-width: 0px;
}
h1:hover:after {
border-bottom-width: 5px;
}
<h1>CSS IS AWESOME</h1>

TIP - how to change position hover effect

I have try add to my website script with help tip. I want change position hover effect because now is wrong. Anyone help me how can I to do?
Here I add screen with Currently effect:
here I paste +/- expected result:
.help-tip{
position: absolute;
top: 55px;
right: 11px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip:hover p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p{ /* The tooltip */
display: none;
text-align: left;
background-color: #1E2021;
padding: 60px;
width: 300px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip p:before{ /* The pointer of the tooltip */
position: absolute;
content: '';
width:0;
height: 0;
border:6px solid transparent;
border-bottom-color:#1E2021;
right:10px;
top:-12px;
}
.help-tip p:after{ /* Prevents the tooltip from being hidden */
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
/* CSS animation */
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
</style>
<div class="help-tip">
<p>MSRP - Sugerowana cena sprzedaży przez producenta</p>
</div>
Anyone provide any solution?
I can put this topic because system return error:
It looks like your post is mostly code; please add some more details.
Just change css for .help-tip p and .help-tip p:before
.help-tip{
position: absolute;
top: 55px;
right: 11px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip:hover p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p {
display: none;
text-align: left;
background-color: #1E2021;
padding: 10px;
width: 300px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
top: -60px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip p:before {
position: absolute;
content: '';
width: 0;
height: 0;
transform: rotate(178deg);
border: 6px solid transparent;
border-bottom-color: #1E2021;
right: 10px;
bottom: -12px;
}
.help-tip p:after{ /* Prevents the tooltip from being hidden */
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
/* CSS animation */
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
</style>
<div class="help-tip">
<p>MSRP - Sugerowana cena sprzedaży przez producenta</p>
</div>
You can change this by changing the absolute positioning of the tooltip.
You need to move the tooltip above the question mark, and flip the pointer of the tooltip. This code should fix it:
.help-tip p {
bottom: 30px;
}
.help-tip p:before {
right: 10px;
bottom: -12px;
transform: rotate(180deg);
}
It will move the tooltip above the question. I've added the code to alter the :before so that the pointer is below, not above, and then rotated it.

Mouse over on button, another div or HTML tag will side out to the left of the button

Hi I have a problem trying to getting the animation at the left hand side of the button when user mouse over the button. One of the example that explain as below:
HTML:
<div class="block">
<div class="normal">
<span>Follow me...</span>
</div>
<a target="_BLANK" class="hover" href="http://twitter.com/benoitboucart" title="My twitter profile">
on Twitter
</a>
CSS:
/**
* CSS3 balancing hover effect
* Read the tutorial here: http://webbb.be/blog/little-css3-3d-hover-effects/
*/
body {background: #f06;background: linear-gradient(45deg, #f06, yellow);min-height: 100%;}
.block {
width: 150px; color: #fff; margin: 30px auto; text-transform: uppercase; text-align: center; font-family: Helvetica;
position: relative;
perspective: 350;
}
.block .normal {
background: gray; padding: 15px; cursor: pointer;
position:relative; z-index:2;
}
.block .hover {
background: #00aced; margin-top:-48px; padding: 15px; display: block; color: #fff; text-decoration: none;
position: relative; z-index:1;
transition: all 250ms ease;
}
.block:hover .normal {
background: #0084b4;
}
.block:hover .hover {
margin-right: 0;
transform-origin: top;
/*
animation-name: balance;
animation-duration: 1.5s;
animation-timing-function: ease-in-out;
animation-delay: 110ms;
animation-iteration-count: 1;
animation-direction: alternate;
*/
animation: balance 1.5s ease-in-out 110ms 1 alternate;
}
#keyframes balance {
0% { margin-top: 0; }
15% { margin-top: 0; transform: rotateX(-50deg); }
30% { margin-top: 0; transform: rotateX(50deg); }
45% { margin-top: 0; transform: rotateX(-30deg); }
60% { margin-top: 0; transform: rotateX(30deg); }
75% { margin-top: 0; transform: rotateX(-30deg); }
100% { margin-top: 0; transform: rotateX(0deg);}
}
https://jsfiddle.net/9dwk8vzg/
Original link:http://dabblet.com/gist/5559193
But for this example is at the bottom instated of at the left hand side of the button, I tried using margin-right and padding-left still unable to get the mouse over appeal div tag to be on the right hand side, may I know what do I miss to get the div tag to appeal on the right hand side/
/**
* CSS3 balancing hover effect
* Read the tutorial here: http://webbb.be/blog/little-css3-3d-hover-effects/
*/
body {background: #f06;background: linear-gradient(45deg, #f06, yellow);min-height: 100%;}
.block {
width: 150px; color: #fff; margin: 30px auto; text-transform: uppercase; text-align: center; font-family: Helvetica;
position: relative;
perspective: 350;
}
.block .normal {
width: 100%;
background: gray; padding: 15px; cursor: pointer;
position:relative; z-index:2;
}
.block .hover {
width: 100%;
background: #00aced;
padding: 15px;
display: block;
position:absolute;
color: #fff;
text-decoration: none;
z-index:1;
transition: all 250ms ease;
right: -30px;
top: 0;
}
.block:hover .normal {
background: #0084b4;
}
.block:hover .hover {
right: 100%;
transform-origin: top;
/*
animation-name: balance;
animation-duration: 1.5s;
animation-timing-function: ease-in-out;
animation-delay: 110ms;
animation-iteration-count: 1;
animation-direction: alternate;
*/
animation: balance 1.5s ease-in-out 110ms 1 alternate;
}
#keyframes balance {
15% { width: 95%; }
30% { width: 105%; }
45% { width: 97%; }
60% { width: 103%; }
75% { width: 97%; }
100% { width: 100%; }
}
<div class="block">
<div class="normal">
<span>Follow me...</span>
</div>
<a target="_BLANK" class="hover" href="http://twitter.com/benoitboucart" title="My twitter profile">
on Twitter
</a>
</div>

Pure css gradually change text on hover

I'm trying to gradually change an element's text while hovering, however it's not working for me.
I have this CSS:
.author-details > div a {
display: inline-block;
width: 30%;
float: none !important;
background-color: #1ABC9C;
color: #fff;
padding: 2% 3% 2% 3%;
border-radius: 7%;
font-weight: normal;
font-size: 16px;
-webkit-transition: background 0.35s linear;
-moz-transition: background 0.35s linear;
-ms-transition: background 0.35s linear;
-o-transition: background 0.35s linear;
transition: background 0.35s linear;
-webkit-box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
-moz-box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
}
.author-details > div a:after {
content: 'Others';
}
.author-details > div a:hover {
background-color: #5DADE2;
}
.author-details > div a:hover:after {
-webkit-animation:fade-in 0.35s ease-in;
}
#-webkit-keyframes fade-in{
0%{
opacity:1;
top:0px;
}
50%{
opacity:0;
top:-5px;
content: 'Me';
}
100%{
opacity:1;
top:-5px;
}
}
And this HTML:
<div><label>View as: </label> </div>
However when I'm hovering on the element the text doesn't change. I want to make it change to "Me" when I'm hovering over it and return to "Others" when I'm not. How can I do that?
Here's a jsFiddle: http://jsfiddle.net/2fgy912p/
Code: http://codepen.io/anon/pen/Qbdvob
This effect works by using hover state to set opacity of absolutely positioned elements' opacity on and off. And they have transition applied so fade in and out effect is achieved.
Jade styled html:
.widget
span view as:
input(type='checkbox',id='toggle')
label.select(for='toggle')
.default others
.hovered you
Css:
* {
margin: 0;
padding: 0;
}
.widget {
font-family: Open Sans;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.widget span {
vertical-align: top;
line-height: 30px;
}
label.select {
user-select: none;
cursor: pointer;
background-color: #3ce;
color: #fff;
border-radius: 2px;
width: 60px;
vertical-align: top;
position: relative;
height: 30px;
display: inline-block;
}
label.select .default,
label.select .hovered {
transition: opacity 1s;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 1;
}
label.select .hovered {
opacity: 0;
}
label.select:hover {
background-color: #36f;
}
label.select .default {
opacity: 1;
}
label.select .hovered {
opacity: 0;
}
label.select:hover .default {
opacity: 0;
}
label.select:hover .hovered {
opacity: 1;
}
You're not defining text to replace when hover the link. Should be:
.author-details > div a:after {
content: 'Others';
}
.author-details > div a:hover:after {
content: 'Me';
}
FIDDLE: https://jsfiddle.net/lmgonzalves/2fgy912p/3/
EDIT1:
I make a few changes to add transitions. See if this is want you want: https://jsfiddle.net/lmgonzalves/2fgy912p/7/
EDIT2:
I hardcoded the top property on each element, that should work, although I see working fine. Check: https://jsfiddle.net/lmgonzalves/2fgy912p/9/

Spinning Effect Anchor tag CSS3

Helo Guys!
I was trying to create a spinning hover effect with CSS3.
Just made a circle spinning effect. Check the jsFiddle here: http://jsfiddle.net/63yyeezn/26/
However what I want to do now is to create something tthat spins but this time its box type
just like this image:
So basically I want similar effect just like the jsFiddle I shown above however this time it must be box.
Really having a hard time figuring this out. Here's my CSS:
body {
background: #292929;
padding-left: 30px;
font-size: 12px;
}
.twist {
display: inline-block;
font-size: 45px;
line-height: 90px;
cursor: pointer;
margin: 20px;
width: 90px;
height: 90px;
border-radius: 50%;
text-align: center;
position: relative;
text-decoration: none;
z-index: 1;
color: #fff;
}
.twist:after {
pointer-events: none;
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
content:'';
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.twist:before {
speak: none;
font-size: 48px;
line-height: 90px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
display: block;
-webkit-font-smoothing: antialiased;
}
.twist.demo-4 {
width: 92px;
height: 92px;
box-shadow: 0 0 0 4px rgba(255, 255, 255, 1);
}
.twist.demo-4:before {
line-height: 92px;
}
.twist.demo-4:after {
top: -4px;
left: -4px;
padding: 0;
z-index: 10;
border: 4px dashed #fff;
}
.twist.demo-4:hover {
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
color: #fff;
}
.twist.demo-4:hover i {
color: #fff;
}
.twist.demo-4.spin:hover {
-webkit-transition: box-shadow 0.2s;
-moz-transition: box-shadow 0.2s;
transition: box-shadow 0.2s;
}
.twist.demo-4.spin:hover:after {
-webkit-animation: spinAround 9s linear infinite;
-moz-animation: spinAround 9s linear infinite;
animation: spinAround 9s linear infinite;
}
#-webkit-keyframes spinAround {
from {
-webkit-transform: rotate(0deg)
}
to {
-webkit-transform: rotate(360deg);
}
}
#-moz-keyframes spinAround {
from {
-moz-transform: rotate(0deg)
}
to {
-moz-transform: rotate(360deg);
}
}
#keyframes spinAround {
from {
transform: rotate(0deg)
}
to {
transform: rotate(360deg);
}
}
Hope you can help me with a jsFiddle file.
Thanks!
My answer won't fit exactly your example, but may interest you as it's a full-CSS3 solution, without HTML markup change. The animation won't be a rotation, but a translation.
Webkit version
.bordered {
overflow: hidden;
}
.bordered:before {
content: '';
position: absolute;
top: 5px; /* 5px: border width */
left: 5px;
right: 5px;
bottom: 5px;
background: white;
z-index: -1;
}
.bordered:after {
content: '';
position: absolute;
top: -50%;
left: -50%;
right: -50%;
bottom: -50%;
background: black;
z-index: -2;
}
.bordered:hover:after {
background: -webkit-linear-gradient(left, white 50%, black 50%); /* black: border color*/
background-size: 20px 100%; /* 20px: dash width */
-webkit-animation: borderAnimated 1s linear infinite;
}
#-webkit-keyframes borderAnimated {
from {
transform: rotate(45deg) translate(0, 0);
}
to {
transform: rotate(45deg) translate(20px, 0);
}
}
/* --- Style only--- */
.bordered {
width: 150px;
height: 150px;
line-height: 150px;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="bordered">Lorem ipsum</div>
The trick is to have a stripped background in the :after pseudo-element, and a fake empty background in the :before element, which will work as a mask. When hovering your element, you just have to animate the :after pseudo-element to get something nice.
Credits: #vsynz
I don't think it can be possible only with static borders. Here is an alternative solution:
.rotating-dashed {
position: relative;
margin: 40px auto;
width: 90px;
height: 90px;
overflow: hidden;
color: #268;
}
.rotating-dashed .dashing {
display: block;
width: 100%;
height: 100%;
position: absolute;
}
.rotating-dashed .dashing:nth-of-type(2) {
-webkit-transform: rotate(90deg);
}
.rotating-dashed .dashing:nth-of-type(3) {
-webkit-transform: rotate(180deg);
}
.rotating-dashed .dashing:nth-of-type(4) {
-webkit-transform: rotate(270deg);
}
.rotating-dashed .dashing i {
display: block;
position: absolute;
left: 0;
top: 0;
width: 200%;
border-bottom: 5px solid
}
.rotating-dashed strong {
display: block;
width: 105%;
line-height: 90px;
text-align: center;
position: absolute;
}
.rotating-dashed:hover {
cursor: pointer;
}
.rotating-dashed:hover .dashing i {
-webkit-animation: slideDash 2.5s infinite linear;
border-bottom: 5px dashed
}
#-webkit-keyframes slideDash {
from {
-webkit-transform: translateX(-50%);
}
to {
-webkit-transform: translateX(0%);
}
}
<div class="rotating-dashed"> <span class="dashing"><i></i></span>
<span class="dashing"><i></i></span>
<span class="dashing"><i></i></span>
<span class="dashing"><i></i></span>
<strong>Demo</strong>
</div>