How can I transition width of content with width: auto?

As I commented, one can’t animate auto (yet), so either use the max-width/max-height trick, or, if you need it to be more exact, set the width using a script. With the max-width/max-height trick, give it a value big enough to accommodate the widest. Stack snippet .myspan { display: inline-block; font-size: 30px; background-color: #ddd; vertical-align: bottom; …

Read more

Apply CSS properties when transition ends

you can add a delay like this: transition: box-shadow 300ms, padding 300ms 400ms; The box-shadow transition will start on hover and last 300ms, and the padding will start after 400ms and again last 300ms. .something { background: blue; color: white; padding: 0px; background-clip: context-box; transition: box-shadow 300ms, padding 300ms 400ms; } .something:hover { box-shadow: 0px …

Read more

CSS transition fade in

CSS Keyframes support is pretty good these days: .fade-in { opacity: 1; animation-name: fadeInOpacity; animation-iteration-count: 1; animation-timing-function: ease-in; animation-duration: 2s; } @keyframes fadeInOpacity { 0% { opacity: 0; } 100% { opacity: 1; } } <h1 class=”fade-in”>Fade Me Down Scotty</h1>

CSS3 Transition not working

A general answer for a general question… Transitions can’t animate properties that are auto. If you have a transition not working, check that the starting value of the property is explicitly set. Sometimes, you’ll want to animate height and width when the starting or finishing value is auto. (For example, to make a div collapse, …

Read more

use transition on ::-webkit-scrollbar?

It is fairly easy to achieve using Mari M’s background-color: inherit; technique in addition with -webkit-background-clip: text;. Live demo; https://jsfiddle.net/s10f04du/ @media screen and (-webkit-min-device-pixel-ratio:0) { .container { overflow-y: scroll; overflow-x: hidden; background-color: rgba(0,0,0,0); -webkit-background-clip: text; transition: background-color .8s; } .container:hover { background-color: rgba(0,0,0,0.18); } .container::-webkit-scrollbar-thumb { background-color: inherit; } }

Hover effects using CSS3 touch events

Use the :active pseudo-class in your css, then add ontouchstart=”” and onmouseover=”” to the body tag. The following code is excerpted from my site, in which I have buttons that get smaller and glow white when hovered(on pcs) or held down(on touch devices) <style> .boxbutton:active{ -webkit-transform:scale(0.9); -moz-transform:scale(0.9); -ms-transform:scale(0.9); -o-transform:scale(0.9); transform:scale(0.9); -webkit-box-shadow:0px 0px 20px #FFF; -moz-box-shadow:0px …

Read more

CSS3 transforms and transitions (Webkit)

Add the vendor prefix in the transitions: p { -webkit-transform: translate(-100%, 0); -moz-transform: translate(-100%, 0); -ms-transform: translate(-100%, 0); -o-transform: translate(-100%, 0); transform: translate(-100%, 0); -webkit-transition: -webkit-transform 1s ease-in; /* Changed here */ -moz-transition: -moz-transform 1s ease-in; -o-transition: -o-transform 1s ease-in; transition: transform 1s ease-in; } a:hover + p { -webkit-transform: translate(0, 0); -moz-transform: translate(0, 0); …

Read more