CSS Transition: ease-out hiccups on chrome - html

I'm working on some buttons that fill with a color when you hover over the button. The transition works perfectly on safari that runs on a MacBook. But when I do the animation on my windows device with Chrome, it has a hiccup on the end with multiple flashes. I have searched around for a solution but I couldn't find any.
.button_slide {
color: black;
border: 2px solid #ffffff;
border-radius: 0px;
padding: 18px 45px;
display: inline-block;
font-family: "Lucida Console", Monaco, monospace;
font-size: 14px;
letter-spacing: 5px;
cursor: pointer;
box-shadow: inset 0 0 0 0 #ffffff;
/* -webkit-transition: ease-out 0.4s !important;
-moz-transition: ease-out 0.4s !important; */
transition: ease-out 0.4s;
}
.slide_diagonal:hover {
box-shadow: inset 400px 50px 0 0 #007ACC;
border: 2px solid #007ACC;
}
#outer {
position: relative;
top: 60%;
left: 50%;
transform: translate(-50%,-50%);
width: 364px;
/*margin: 50px auto 0 auto;*/
text-align: center;
}
<div id="outer">
<div class="button_slide slide_diagonal">KLIK HIER</div>
</div>
Reason of hiccup
The answer from DreamTeK helped out to point out the issue. It looks like that when a transform transform: translate(-50%,-50%); is applied to #outer, Chrome will hiccup the animation. The only question that will be left is, why does this cause the issue?
edit: typos, extra information

I wasn't able to pinpoint the exact reason Chrome has issues with the box-transition however I used a differant method that creates the same effect much smoother.
#outer {
width: 220px;
margin: 50px auto;
text-align: center;
}
.button_slide {
position: relative;
color: black;
border: 2px solid #ffffff;
padding: 18px 45px;
display: block;
font: 14px "Lucida Console", Monaco, monospace;
letter-spacing: 5px;
text-decoration: none;
cursor: pointer;
transition: ease-out 0.4s;
width: 100%;
box-sizing: border-box;
}
.button_slide::before {
content: '';
box-shadow: inset 0 0 0 0 #fff;
transition: ease-in-out 0.4s;
border: 2px solid #fff;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
box-sizing: border-box;
z-index: -1;
}
.slide_diagonal:hover::before {
box-shadow: inset 300px 50px 0 0 #007ACC;
border-color: #007ACC;
}
<div id="outer">
<a class="button_slide slide_diagonal">KLIK HIER</a>
</div>

Related

Moving border on hover (CSS)

I love the buttons on this site - https://veronicaromney.com/
I tried copying the CSS from the site but I am not making it work right.
I do use Elementor, I added the code to the theme (for the button) and then the ID to the button, but what I got is that the button block (entire block) got the CSS and did nothing on hover.
Can you help me build these buttons?
Here is the code I have so far that pretty much isn't working for me.
.mmb-btn { -webkit-text-size-adjust: 100%;
box-sizing: border-box;
text-decoration: none;
text-rendering: optimizeLegibility;
position: relative;
color: #fff;
border: 0 none;
box-shadow: 0 4px 13px rgba(0, 0, 0, 0.1);
background-color: #e4b067;
display: inline-block;
transition: none 0s ease 0s;
text-align: inherit;
line-height: 24px;
border-width: 0px;
margin: 0 auto;
padding: 12px 33px 11px;
letter-spacing: 4px;
font-weight: 400;
font-size: 14px;
}
.mmb-btn:before {
border: 1px solid #000;
top: 7px;
left: 7px;
}
.mmb-btn::after {
bottom: 0;
right: 0;
}
.mmb-btn:before, .mmb-btn:after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
transition-property: all;
transition-duration: 0.25s;
transition-timing-function: ease;
transition-delay: 0s;
}
.mmb-btn { -webkit-text-size-adjust: 100%;
box-sizing: border-box;
text-decoration: none;
text-rendering: optimizeLegibility;
position: relative;
color: #fff;
border: 0 none;
box-shadow: 0 4px 13px rgba(0, 0, 0, 0.1);
background-color: #e4b067;
display: inline-block;
transition: none 0s ease 0s;
text-align: inherit;
line-height: 24px;
border-width: 0px;
margin: 0 auto;
padding: 12px 33px 11px;
letter-spacing: 4px;
font-weight: 400;
font-size: 14px;
}
.mmb-btn:before {
border: 1px solid #000;
top: 7px;
left: 7px;
}
.mmb-btn::after {
bottom: 0;
right: 0;
}
.mmb-btn:before, .mmb-btn:after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
transition-property: all;
transition-duration: 0.25s;
transition-timing-function: ease;
transition-delay: 0s;
}
.mmb-btn:hover:before, .mmb-btn:hover:after {
top: 0;
left: 0;
transition: all 0.25s ease;
}
<a id="start-here-btn" class="mmb-btn alignright" href="/contact/"> GET STARTED </a>
You were missing .mmb-btn:hover:before, .mmb-btn:hover:after.
A quickie because why not. I suggest using transform instead of changing the position as it's more dom fluid and semantically cleaner.
Also remember to apply pointer-events: none to the pseudo element so you don't get the spazzy behavior when someone hovers the border outside of the button like you see on the other answers provided.
.fancy-btn {
padding: .5rem 1.5rem;
background-color: #eee;
position: relative;
transition: background-color .5s ease;
}
.fancy-btn:after {
content: '';
display: block;
pointer-events: none;
border: red 1px solid;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
transform: translate(1rem,1rem);
transition: transform .25s ease;
}
.fancy-btn:hover {
background-color: yellow;
}
.fancy-btn:hover:after {
top: 0;
left: 0;
border-color: green;
transform: translate(0,0);
}
body {
height: 90vh;
display: flex;
align-items: center;
justify-content: center;
}
<a class="fancy-btn">HEY I AM A BUTTON, YAY</a>
You have to add only the :hoverpseudo class.
.mmb-btn:hover::before, .mmb-btn:hover::after {
top: 0;
left: 0;
transition: all 0.25s ease;
}
.mmb-btn { -webkit-text-size-adjust: 100%;
box-sizing: border-box;
text-decoration: none;
text-rendering: optimizeLegibility;
position: relative;
color: #fff;
border: 0 none;
box-shadow: 0 4px 13px rgba(0, 0, 0, 0.1);
background-color: #e4b067;
display: inline-block;
transition: none 0s ease 0s;
text-align: inherit;
line-height: 24px;
border-width: 0px;
margin: 0 auto;
padding: 12px 33px 11px;
letter-spacing: 4px;
font-weight: 400;
font-size: 14px;
}
.mmb-btn:before {
border: 1px solid #000;
top: 7px;
left: 7px;
}
.mmb-btn::after {
bottom: 0;
right: 0;
}
.mmb-btn:before, .mmb-btn:after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
transition-property: all;
transition-duration: 0.25s;
transition-timing-function: ease;
transition-delay: 0s;
}
.mmb-btn:hover::before, .mmb-btn:hover::after {
top: 0;
left: 0;
transition: all 0.25s ease;
}
GET STARTED

html/css max-width not working

So I have a tooltip on tumblr and everything about the code is working except the max width, it's stuck at 75px. I've changed it to 250px and 300px and it refuses to stretch with the words in the tooltip.
Code:
a[tooltip]:hover:after {
position: absolute;
z-index: 99999999;
max-width: 300px;
min-width: 60px;
border: 1px solid #bababa;
padding: 6px;
margin: -27px 0px 0px 28px;
background-color: #ffffff;
color: #1a2242;
font-family: arial;
font-size: 7px;
line-height: 12px;
letter-spacing: 1px;
text-transform: uppercase;
font-weight: none;
text-align: center;
box-shadow: rgba(0, 0, 0, 0.04)0 2px 4px;
opacity: 1;
content: attr(tooltip);
transition-duration: 0.6s;
-moz-transition-duration: 0.6s;
-webkit-transition-duration: 0.6s;
-o-transition-duration: 0.6s;
}
#s-m-t-tooltip {
position: absolute;
z-index: 99999999;
max-width: 300px;
min-width: 60px;
border: 1px solid #bababa;
padding: 6px;
margin: -27px 0px 0px 28px;
background-color: #ffffff;
color: #1a2242;
font-family: arial;
font-size: 7px;
line-height: 12px;
letter-spacing: 1px;
text-transform: uppercase;
font-weight: none;
text-align: center;
box-shadow: rgba(0, 0, 0, 0.04)0 2px 4px;
opacity: 1;
outline: 0px solid #ddd;
-moz-transition-duration: 0.3s;
-webkit-transition-duration: 0.3s;
-o-transition-duration: 0.3s;
}
Link
Any help is appreciated and if you need more information, let me know.
add width: 100%; for your pseudo element, also you can use box-sizing so that the width and height properties set the dimensions of the content rather than the content.
`
a[tooltip]:hover:after {
width: 100%;
box-sizing: border-box;
position: absolute;
z-index: 99999999;
max-width: 300px;
min-width: 60px;
border: 1px solid #bababa;
padding: 6px;
margin: -5px 0 0 28px;
background-color: #ffffff;
color: #1a2242;
font-family: arial;
font-size: 7px;
line-height: 12px;
letter-spacing: 1px;
text-transform: uppercase;
font-weight: none;
text-align: center;
box-shadow: rgba(0, 0, 0, 0.04)0 2px 4px;
opacity: 1;
content: attr(tooltip);
transition-duration: 0.6s;
-moz-transition-duration: 0.6s;
-webkit-transition-duration: 0.6s;
-o-transition-duration: 0.6s;
}
#s-m-t-tooltip {
position: absolute;
z-index: 99999999;
width: 300px;
max-width: 200px;
min-width: 60px;
border: 1px solid #bababa;
padding: 6px;
margin: -27 0 0 28px;
background-color: #ffffff;
color: #1a2242;
font-family: arial;
font-size: 7px;
line-height: 12px;
letter-spacing: 1px;
text-transform: uppercase;
font-weight: none;
text-align: center;
box-shadow: rgba(0, 0, 0, 0.04)0 2px 4px;
opacity: 1;
outline: 0px solid #ddd;
-moz-transition-duration: 0.3s;
-webkit-transition-duration: 0.3s;
-o-transition-duration: 0.3s;
}
Link
The reason it's not working is because you have a width:100% set on the a:after pseudo-element. That property will set the width of the element to that of it's parent, in this case your a is a child of your <div class="markericon1">. You can see that if you change just the width of <div class="markericon1"> to something higher you will get the result you want.
.markericon1 {
width:300px;
}

Change image in button on hover

I want to change the image on the button to this white version of it:http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png when hovered on. I thought I would just add a background-image to the :hover but that didn't work. Does anyone know how I can accomplish this? Anything helps, Cheers!
.button_slidehr {
color: #156466;
border: 1px solid rgba(21,100,102,0.35);
border-radius: 0px;
/* extend left padding */
padding: 18px 15px 18px 62px;
position: relative;
display: inline-block;
font-family: Verdana;
font-size: 14px;
margin-bottom: 20px;
letter-spacing: 1px;
background-color: rgba(255,255,255,0.3);
cursor: pointer;
box-shadow: inset 0 0 0 0 #156466;
-webkit-transition: ease-out 0.4s;
-moz-transition: ease-out 0.4s;
transition: ease-out 0.4s;
}
.slide_downhr:hover {
color:white;
border: 1px solid transparent;
box-shadow: inset 0 100px 0 0 #156466;
}
.button_slidehr:after {
content: "";
display: inline-block;
position: absolute;
left: 10px;
top: 0;
width: 100%;
height: 100%;
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498058230/HR-Connect-Logo_hjbrmn.png);
background-position: left center;
background-repeat: no-repeat;
background-size: auto 80%;
}
<div class="button_slidehr slide_downhr">Contact HR Now></div>
.button_slidehr {
color: #156466;
border: 1px solid rgba(21,100,102,0.35);
border-radius: 0px;
/* extend left padding */
padding: 18px 15px 18px 62px;
position: relative;
display: inline-block;
font-family: Verdana;
font-size: 14px;
margin-bottom: 20px;
letter-spacing: 1px;
background-color: rgba(255,255,255,0.3);
cursor: pointer;
box-shadow: inset 0 0 0 0 #156466;
-webkit-transition: ease-out 0.4s;
-moz-transition: ease-out 0.4s;
transition: ease-out 0.4s;
}
.slide_downhr:hover {
color:white;
border: 1px solid transparent;
box-shadow: inset 0 100px 0 0 #156466;
}
.button_slidehr:hover:after {
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png);
}
.button_slidehr:after {
content: "";
display: inline-block;
position: absolute;
left: 10px;
top: 0;
width: 100%;
height: 100%;
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498058230/HR-Connect-Logo_hjbrmn.png);
background-position: left center;
background-repeat: no-repeat;
background-size: auto 80%;
}
<div class="button_slidehr slide_downhr">Contact HR Now></div>
.slide_downhr:hover:after {
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png);
}

Dropdown menu fades in, but doesn't fade out

I've coded a dropdown menu with HTML and CSS, and I can sucessfully have it fade in when the user's mouse hovers over the button in the menu. However, when the mouse leaves the dropdown, the dropdown doesn't fade out, it just disappears? I believe this is a syntax error but I'm not sure where. How can I make the dropdown fade out just like I made it fade in?
.top-block-container {
float: left;
width: 50%;
margin: 0.5% 0.25%;
}
.top-block-container:hover .top-block-dropdown {
visibility: visible;
opacity: 1;
transform: translateY(0);
height: auto;
}
.top-block {
width: 100%;
font-family: Lato;
font-weight: 900;
text-align: center;
padding: 10px 0;
border-radius: 50px;
font-size: 25px;
transition: background-color 0.25s linear, box-shadow 0.25s linear;
float: left;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
box-shadow: 0 0 5px black;
margin: 0;
}
.top-block:hover {
cursor: pointer;
box-shadow: 0 0 15px black;
}
.top-block-dropdown {
width: 100%;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
float: left;
margin-top: 7.5px;
border-radius: 25px;
box-shadow: 0 0 15px black;
visibility: hidden;
opacity: 0;
height: 0;
transform: translateY(-2em);
transition: visibility 0s, transform 0.25s, opacity 0.25s linear;
}
.dropdown-option-heading {
font-family: Lato;
font-weight: 700;
margin: 5px 0 0 0;
padding: 5px 10px;
border-bottom: 2px solid white;
}
.dropdown-option {
font-family: Lato;
font-weight: 400;
text-align: center;
border-bottom: 1px solid white;
margin: 0;
padding: 5px 10px;
transition: box-shadow 0.25s linear;
}
.dropdown-option:hover {
background: linear-gradient(to top, dodgerblue, #00B0FF);
cursor: pointer;
}
.last-option {
border: 0;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
<div class="top-block-container">
<h1 class="top-block">ECWMF</h1>
<div class="top-block-dropdown">
<p class="dropdown-option-heading">Global Models</p>
<p class="dropdown-option">GFS</p>
<p class="dropdown-option">ECMWF</p>
<p class="dropdown-option">CMC</p>
<p class="dropdown-option">NAVGEM</p>
<p class="dropdown-option">UKMET</p>
<p class="dropdown-option-heading">Mesoscale Models</p>
<p class="dropdown-option">HRRR</p>
<p class="dropdown-option">HWRF</p>
<p class="dropdown-option">NAM 32km</p>
<p class="dropdown-option">NAM 12km</p>
<p class="dropdown-option">RAP</p>
<p class="dropdown-option">SREF</p>
<p class="dropdown-option last-option">HIRESW</p>
</div>
</div>
Your CSS transition says for the div's visibility to change in zero seconds:
.top-block-dropdown { transition: visibility 0s ... }
So the div disappears instantly. You just need a longer transition time.
Because your transition has visibility 0s. Give that a non-zero value and the visibility transitions. Or just remove visibility from all of those definitions. opacity will suffice.
.top-block-container {
float: left;
width: 50%;
margin: 0.5% 0.25%;
}
.top-block-container:hover .top-block-dropdown {
opacity: 1;
transform: translateY(0);
height: auto;
}
.top-block {
width: 100%;
font-family: Lato;
font-weight: 900;
text-align: center;
padding: 10px 0;
border-radius: 50px;
font-size: 25px;
transition: background-color 0.25s linear, box-shadow 0.25s linear;
float: left;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
box-shadow: 0 0 5px black;
margin: 0;
}
.top-block:hover {
cursor: pointer;
box-shadow: 0 0 15px black;
}
.top-block-dropdown {
width: 100%;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
margin-top: 7.5px;
border-radius: 25px;
box-shadow: 0 0 15px black;
opacity: 0;
height: 0;
transform: translateY(-2em);
transition: transform 0.25s, opacity 0.25s linear;
}
.dropdown-option-heading {
font-family: Lato;
font-weight: 700;
margin: 5px 0 0 0;
padding: 5px 10px;
border-bottom: 2px solid white;
}
.dropdown-option {
font-family: Lato;
font-weight: 400;
text-align: center;
border-bottom: 1px solid white;
margin: 0;
padding: 5px 10px;
transition: box-shadow 0.25s linear;
}
.dropdown-option:hover {
background: linear-gradient(to top, dodgerblue, #00B0FF);
cursor: pointer;
}
.last-option {
border: 0;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
<div class="top-block-container">
<h1 class="top-block">ECWMF</h1>
<div class="top-block-dropdown">
<p class="dropdown-option-heading">Global Models</p>
<p class="dropdown-option">GFS</p>
<p class="dropdown-option">ECMWF</p>
<p class="dropdown-option">CMC</p>
<p class="dropdown-option">NAVGEM</p>
<p class="dropdown-option">UKMET</p>
<p class="dropdown-option-heading">Mesoscale Models</p>
<p class="dropdown-option">HRRR</p>
<p class="dropdown-option">HWRF</p>
<p class="dropdown-option">NAM 32km</p>
<p class="dropdown-option">NAM 12km</p>
<p class="dropdown-option">RAP</p>
<p class="dropdown-option">SREF</p>
<p class="dropdown-option last-option">HIRESW</p>
</div>
</div>

HTML5 Modal Window not working in IE or Chrome

On the page http://canadianwhoswho.ca/order-subscribeonline.php I have created a modal window that opens when users click http://canadianwhoswho.ca/order-subscribeonline.php#openModal. This works perfectly in Firefox, but not in IE or Chrome. Instead, it just adds the modal text to the top of the page.
Here is the CSS:
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 400px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #E4E4E4;
background: -moz-linear-gradient(#E4E4E4, #F6F6F6);
background: -webkit-linear-gradient(#E4E4E4, #F6F6F6);
background: -o-linear-gradient(#E4E4E4, #F6F6F6);
}
.close {
background: #E4E4E4;
color: #922211 !important;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.close:hover {
background: #922211;
color: #E4E4E4 !important;
}
And the HTML:
<div id="openModal" class="modalDialog">
<div>
X
<h2>Thank you for your interest in <em>Canadian Who's Who</em></h2>
<p>To place an order, please contact us at info#canadianwhoswho.ca, or call 705-325-5552.</p>
</div>
Choose</p>
i found similar answer on http://cameronbaney.com/2012/07/26/pure-html5css3-responsive-modal-window/
I have tried it and works for all three IE, Chrome and Firefox.
Hope it helps.