I watched a video on Youtube about the hover effect, and I'm trying to do it by myself, but the problem is it's not working on google chrome: :before and :after background overflow when the transition executes.
In Firefox it works without any problem.
I thought it might be happening because I didn't use any prefixes, so I includes prefixes in code but the problem didn't go away
to be clear my problem
background of :before and :after show out of button border
body {
display: flex;
margin: 0;
padding: 0;
align-items: center;
justify-content: center;
height: 100vh;
}
a {
overflow: hidden;
display: block;
position: relative;
text-decoration: none;
color: #000;
border: 4px solid #000;
padding: 10px 30px;
font-size: 20px;
letter-spacing: 12px;
border-radius: 30px;
-webkit-border-radius: 30px;
text-transform: uppercase;
transition:color 1s ease-in-out;
transition-delay: 1s;
}
a:before {
content:'';
position: absolute;
top: 50%;
left: 60px;
height: 8px;
width: 8px;
background-color: #F00;
transform:scale(0.8);
-webkit-transform:scale(0.8);
border-radius:100%;
-webkit-border-radius:100%;
z-index: -1;
opacity:0;
transition-property:transform,left,opacity;
transition-delay: 0s,1s,1.5s;
transition-duration: 1s,1s,0s;
}
a:hover:before {
border-radius:100%;
-webkit-border-radius:100%;
opacity:1;
left: 10px;
transform:scale(33);
-webkit-transform:scale(33);
transition-property:opacity,left,transform;
transitiion-delay:0s,0.5s,2s;
transition-duration: 0s,0.5s,1s;
}
a:after {
content:'';
position: absolute;
top: 50%;
right: 60px;
height: 8px;
width: 8px;
background-color: #F00;
transform:scale(0.8);
-webkit-transform:scale(0.8);
border-radius:100%;
-webkit-border-radius:100%;
z-index: -1;
opacity:0;
transition-property:transform,right,opacity;
transition-delay: 0s,1s,1.5s;
transition-duration: 1.5s,1s,0s;
}
a:hover:after {
opacity:1;
right: 10px;
transform:scale(33);
-webkit-transform:scale(33);
transition-property:opacity,right,transform;
transitiion-delay:0s,0.5s,2s;
transition-duration: 0s,0.5s,1s;
}
a:hover{
color:#FFF;
}
Button
You have written transitiion instead of transition several times.
Your transition seems to be working (even if you do not say what you would like to do), it's just a little long.
You can play with the delay to change the duration of the animation, here is your code with shortened delays:
body {
display: flex;
margin: 0;
padding: 0;
align-items: center;
justify-content: center;
height: 100vh;
}
a {
overflow: hidden;
display: block;
position: relative;
text-decoration: none;
color: #000;
border: 4px solid #000;
padding: 10px 30px;
font-size: 20px;
letter-spacing: 12px;
border-radius: 30px;
-webkit-border-radius: 30px;
text-transform: uppercase;
transition:color .2s ease-in-out;
transition-delay: .1s;
}
a:before {
content:'';
position: absolute;
top: 50%;
left: 60px;
height: 8px;
width: 8px;
background-color: #F00;
transform:scale(0.8);
-webkit-transform:scale(0.8);
border-radius:100%;
-webkit-border-radius:100%;
z-index: -1;
opacity:0;
transition-property:transform,left,opacity;
transition-delay: 0s,.5s,.5s;
transition-duration: .5s,.5s,0s;
}
a:hover:before {
border-radius:100%;
-webkit-border-radius:100%;
opacity:1;
left: 10px;
transform:scale(33);
-webkit-transform:scale(33);
transition-property:opacity,left,transform;
transition-delay:0s,0.2s,.2s;
transition-duration: 0s,0.2s,.2s;
}
a:after {
content:'';
position: absolute;
top: 50%;
right: 60px;
height: 8px;
width: 8px;
background-color: #F00;
transform:scale(0.8);
-webkit-transform:scale(0.8);
border-radius:100%;
-webkit-border-radius:100%;
z-index: -1;
opacity:0;
transition-property:transform,right,opacity;
transition-delay: 0s,.2s,.2s;
transition-duration: .2s,.2s,0s;
}
a:hover:after {
opacity:1;
right: 10px;
transform:scale(33);
-webkit-transform:scale(33);
transition-property:opacity,right,transform;
transition-delay:0s,0.2s,.2s;
transition-duration: 0s,0.2s,.2s;
}
a:hover{
color:#FFF;
}
Button
I'm not sure to understand your problem but if it is the absence of transition it could be because you have wrote transitiion-delay instead of transition-delay.
I have tried your code with Chrome and Firefox and didn't noticed a difference.
You can learn more about the need (or absence of need) for prefixes on this website : https://caniuse.com/#search=transform
I have a currency converter,
This is how it looks like:
https://gyazo.com/661e6713051bb5ddb288a92f66b24c92
So, I have that arrow inserted after a class with :after , however, on some themes(We are doing a project for shopify) i have to give the arrow a right in order for it to look good. Any ideeas how can i get the arrow inside the border?
the css looks like
.vitals-nice-select {
-webkit-tap-highlight-color: transparent;
background-color: #fff;
color: #333;
box-sizing: border-box;
clear: both;
cursor: pointer;
display: block;
float: left;
font-family: inherit;
font-size: 14px;
font-weight: normal;
height: 42px;
line-height: 40px;
outline: none;
padding-left: 18px;
padding-right: 23px;
position: relative;
text-align: left !important;
webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: auto;
border-radius: 5px;
border: solid 1px #e8e8e8;
}
.vitals-nice-select:hover {
border-color: #dbdbdb;
}
and for the arrow
.vitals-nice-select:after {
border-bottom: 2px solid #999;
border-right: 2px solid #999;
content: \'\';
display: block;
height: 5px;
margin-top: -4px;
pointer-events: none;
position: absolute;
right: 12px;
top: 50%;
-webkit-transform-origin: 66% 66%;
-ms-transform-origin: 66% 66%;
transform-origin: 66% 66%;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
width: 5px;
}
Is this what u want?
.vitals-nice-select {
-webkit-tap-highlight-color: transparent;
background-color: #fff;
color: #333;
box-sizing: border-box;
clear: both;
cursor: pointer;
display: block;
float: left;
font-family: inherit;
font-size: 14px;
font-weight: normal;
height: 42px;
line-height: 42px;
outline: none;
padding-left: 18px;
padding-right: 30px;
position: relative;
text-align: left !important;
webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: auto;
border-radius: 5px;
border: solid 1px #e8e8e8;
}
.vitals-nice-select:hover {
border-color: #dbdbdb;
}
.vitals-nice-select:after {
border-bottom: 2px solid #999;
border-right: 2px solid #999;
content: '';
display: block;
height: 5px;
pointer-events: none;
position: absolute;
right: 12px;
top: 50%;
transform: rotate(45deg) translateX(-50%);
transition: all 0.15s ease-in-out;
width: 5px;
}
<div class="vitals-nice-select">TextTextText</div>
See the fiddle here: https://jsfiddle.net/9o1L1Lg4/
Add the following properties:
.vitals-nice-select {
position: relative;
}
.vitals-nice-select:after {
position: absolute;
right: 0;
/* If you want to center it vertically add the following properties */
top: 50%;
transform: translatey(-50%);
}
I have a simple arrow which is like this:
>
and on hover I want it to expand to look like this:
->
of course without the gap between them.
This has to be a transition + animation between them to be smooth. Here's what I have so far
My Work
body,
html {
margin: 0;
padding: 0;
max-width: 100%;
max-height: 100%;
overflow-x: hidden;
position: relative;
background-color: black;
}
.button {
display: inline-block;
vertical-align: middle;
border-radius: 50%;
margin: 6em 0 0;
padding: 0;
text-align: center;
}
.left {
display: inline-block;
width: 3em;
height: 3em;
border: 0.5em solid #333;
border-radius: 50%;
margin-right: 1.5em;
}
.left:after {
content: '';
display: inline-block;
margin-top: 0.90em;
margin-left: 0.6em;
width: 0.8em;
height: 0.8em;
border-top: 0.5em solid #333;
border-right: 0.5em solid #333;
-moz-transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
}
.right {
color: white;
display: inline-block;
width: 3em;
height: 3em;
border: 0.5em solid #333;
border-radius: 50%;
margin-left: 1.5em;
}
.right:after {
content: '';
display: inline-block;
margin-top: 0.90em;
margin-left: -0.6em;
width: 0.8em;
height: 0.8em;
border-top: 0.5em solid #333;
border-right: 0.5em solid #333;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.right:hover {
content: '';
display: inline-block;
margin-top: 0.90em;
margin-left: -0.6em;
width: 2em;
height: 2em;
border-top: 0.5em solid #333;
border-right: 0.5em solid #333;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
<body>
<div class="button">
<span class="left"></span>
</div>
<div class="button">
<span class="right"></span>
</div>
</body>
Any ideas how can I achieve smooth transition and animation from between those 2 arrows?
Well, hope this help. I did it by insert another pseudo class onhover of your right class.
.right:hover:before {
content: '';
height: 0.5em;
width: 1.4em;
background-color: #333333;
display: inline-block;
transform: translate(6px,-6px);
max-width: 2em;
transition: 0.5s all ease-in-out;
}
.right:before {
content: '';
transition: 0.5s all ease-in-out;
max-width: 0em;
}
If you insert this, you must remove .right:hover. Check this pen.
I am trying to get a CSS tooltip to work correctly which I found on the thoughtbot blog. The only changes that I have made to the code is to change from Scss to CSS, and simplify the html a touch. However, when in CSS, it doesnt work.
The original article can be found here, where there is also a working codepen that I copied as the basis for my CSS version https://robots.thoughtbot.com/you-don-t-need-javascript-for-that
.container {
margin-top: 100px;
margin-left: 100px;
border: 2px solid red;
}
/* //The good stuff */
.tooltip-toggle {
cursor: pointer;
position: relative;
}
/* //Tooltip text container */
.tooltip-toggle::before {
position: absolute;
top: -80px;
left: -80px;
background-color: #2B222A;
border-radius: 5px;
color: #fff;
content: attr(data-tooltip);
padding: 1rem;
text-transform: none;
transition: all 0.5s ease;
width: 160px;
}
/*
//Tooltip arrow */
.tooltip-toggle::after {
position: absolute;
top: -12px;
left: 9px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #2B222A;
content: " ";
font-size: 0;
line-height: 0;
margin-left: -5px;
width: 0;
}
.tooltip-toggle::before {
color: #efefef;
font-family: monospace;
font-size: 16px;
opacity: 0;
pointer-events: none;
text-align: center;
}
.tooltip-toggle::after {
color: #efefef;
font-family: monospace;
font-size: 16px;
opacity: 0;
pointer-events: none;
text-align: center;
}
/* //Triggering the transition */
.tooltip-toogle:hover::before {
opacity: 1;
transition: all 0.75s ease;
}
.tooltip-toggle:hover::after {
opacity: 1;
transition: all 0.75s ease;
}
Below is my html.
<html>
<body>
<div class="container tooltip-toggle" data-tooltip="Sample text for your tooltip!>
<div class="label">Hello
</div>
</div>
</body>
</html>
So, I laughed very hard when I figured your problem out:
/* //Triggering the transition */
.tooltip-toogle:hover::before {
opacity: 1;
transition: all 0.75s ease;
}
.tooltip-toogle:hover
Obviously should be toggle, lol.
Edit: cleaned css and fixed it
.container {
margin-top: 100px;
margin-left: 100px;
border: 2px solid red;
}
/* The good stuff */
.tooltip-toggle {
cursor: pointer;
position: relative;
}
/* Tooltip text container */
.tooltip-toggle::before {
position: absolute;
top: -80px;
left: -80px;
background-color: #2B222A;
border-radius: 5px;
color: #fff;
content: attr(data-tooltip);
padding: 1rem;
text-transform: none;
transition: all 0.5s ease;
width: 160px;
}
/* Tooltip arrow */
.tooltip-toggle::after {
position: absolute;
top: -12px;
left: 9px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #2B222A;
content: " ";
font-size: 0;
line-height: 0;
margin-left: -5px;
width: 0;
}
.tooltip-toggle::before, .tooltip-toggle::after {
color: #efefef;
font-family: monospace;
font-size: 16px;
opacity: 0;
pointer-events: none;
text-align: center;
}
/* Triggering the transition */
.tooltip-toogle:hover::before, .tooltip-toggle:hover::after {
opacity: 1;
transition: all 0.75s ease;
}
I have about 6 divs that I set to position: absolute.
After reading other threads, I made sure the parent element was set to position: relative,
Still for some reason the vertical positioning of these elements differ depending on browser/device.
For example, the positioning looks okay on chrome for macbook.
But it is off on Safari for Macbook, Safari on iPad as well as Chrome and IE for Windows.
http://codepen.io/donnaloia/pen/WbYbLa
It is the suggestion divs (in light gray), that are not positioning correctly.
What am I doing wrong here? Why is this happening?
.backgroundiv {
background-image: url(/static/img/bg-hero.jpg);
width: 100%;
position: relative;
padding-top: 25px;
height: 986px;
}
.background2div {
background-color: black;
background-repeat: repeat;
height: 800px;
position: relative;
}
.linecontainer {
width: 486px;
display: inline-block;
margin-left: 68px;
}
.formdiv {
padding-top: 50px;
float: center;
background-color: white;
height: 845px;
margin: 0 auto;
border-radius: 3px;
width: 632px;
position: relative;
}
.selltitle {
font-family: futura;
font-size: 28px;
text-align: center;
padding-bottom: 50px;
}
.forminput {
float:right;
margin-bottom: 32px;
}
.forminput input {
padding-top: .5em;
padding-bottom: .5em;
width: 230px;
}
.forminput submit {
padding-top: .5em;
}
.forminput2 {
float:right;
width: 232px;
margin-bottom: 32px;
}
textarea {
padding: .5em;
width: 221px;
border: 1px solid rgba(0, 0, 0, 0.2);
}
.checkmark1{
top: 228px;
display:none;
height: 10px;
position: absolute;
width: 20px;
left: 894px;
}
.checkmarkimg {
width:20px;
}
.checkmark2{
top:285px;
display:none;
height: 10px;
position: absolute;
width: 20px;
left: 894px;
}
.checkmark3{
top:462px;
display:none;
height: 10px;
position: absolute;
width: 20px;
left: 894px;
}
.checkmark4{
top:545px;
display:none;
height: 10px;
position: absolute;
width: 20px;
left: 894px;
}
.checkmark5{
top:603px;
display:none;
height: 10px;
position: absolute;
width: 20px;
left: 894px;
}
input.parsley-success,
select.parsley-success,
textarea.parsley-success {
color: #468847;
background-color: #DFF0D8;
border: 1px solid #D6E9C6;
}
input.parsley-error,
select.parsley-error,
textarea.parsley-error {
color: #B94A48;
background-color: #F2DEDE;
border: 1px solid #EED3D7;
}
.inputholder.parsley-success.checkmarksuccess {
display: block;
width:26px;
height:24px;
position:absolute;
}
.parsley-errors-list {
margin: 2px 0 3px 0;
padding: 0;
list-style-type: none;
font-size: 0.9em;
line-height: 0.9em;
opacity: 0;
position: absolute;
padding-top: 6px;
font-size:14px;
-moz-opacity: 0;
-webkit-opacity: 0;
transition: all .3s ease-in;
-o-transition: all .3s ease-in;
-ms-transition: all .3s ease-in;
-moz-transition: all .3s ease-in;
-webkit-transition: all .3s ease-in;
}
.parsley-errors-list.filled {
opacity: .5;
}
.suggest1{
opacity: .45;
margin-left:68px;
position:absolute;
top:153px;
font-style: italic;
}
.suggest2{
opacity: .45;
margin-left:68px;
width:150px;
position:absolute;
top:202px;
font-style: italic;
}
.suggest3{
opacity: .45;
margin-left:68px;
position:absolute;
top:297px;
font-style: italic;
}
.suggest4{
opacity: .45;
margin-left:68px;
position:absolute;
top:344px;
font-style: italic;
}
.suggest5{
opacity: .45;
margin-left:68px;
position:absolute;
top:392px;
width:132px;
font-style: italic;
}
.suggest6{
opacity: .45;
margin-left:68px;
position:absolute;
top:440px;
width:132px;
font-style: italic;
}
.suggest7{
color: red;
opacity: .75;
margin-left:325px;
position:absolute;
top:252px;
width:132px;
font-size:14px;
}
.suggest8{
opacity: .45;
margin-left:68px;
position:absolute;
top:489px;
width:132px;
font-style: italic;
}