How to Animate Gradients using CSS

Please try this code: #gradient { height:300px; width:300px; border:1px solid black; font-size:30px; background: linear-gradient(130deg, #ff7e00, #ffffff, #5cff00); background-size: 200% 200%; -webkit-animation: Animation 5s ease infinite; -moz-animation: Animation 5s ease infinite; animation: Animation 5s ease infinite; } @-webkit-keyframes Animation { 0%{background-position:10% 0%} 50%{background-position:91% 100%} 100%{background-position:10% 0%} } @-moz-keyframes Animation { 0%{background-position:10% 0%} 50%{background-position:91% 100%} 100%{background-position:10% 0%} … Read more

Changing :hover to touch/click for mobile devices

If you use :active selector in combination with :hover you can achieve this according to w3schools as long as the :active selector is called after the :hover selector. .info-slide:hover, .info-slide:active{ height:300px; } You’d have to test the FIDDLE in a mobile environment. I can’t at the moment. correction – I just tested in a mobile, … Read more

Animating max-height with CSS transitions

Fix delay solution: Put cubic-bezier(0, 1, 0, 1) transition function for element. scss .text { overflow: hidden; max-height: 0; transition: max-height 0.5s cubic-bezier(0, 1, 0, 1); &.full { max-height: 1000px; transition: max-height 1s ease-in-out; } } css .text { overflow: hidden; max-height: 0; transition: max-height 0.5s cubic-bezier(0, 1, 0, 1); } .text.full { max-height: 1000px; … Read more

Why can’t I animate custom properties (aka CSS variables)?

When this question was asked, it wasn’t possible to animate custom properties, as @temani afif correctly pointed out – since the UA has no way to interpret their contents Since then, CSS Houdini have put together the CSS Properties and Values API specification This specification extends [css-variables], allowing the registration of properties that have a … Read more

SVG. Reverse image using css. Keep image at the same place

Use transform-origin and transform-box $(“.example”).on(“click”, function(e){ $(e.target).toggleClass(“reverse”); }) .reverse{ transform: scaleX(-1); transform-origin: center; transform-box: fill-box; } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <div style=”width: 700px;height: 700px;margin-left: 100px”> <svg viewBox=”-200 0 700 700″> <image class=”example” href=”https://i.pinimg.com/originals/6f/3d/6a/6f3d6aab605e25af947d804c4a2cb558.jpg” width=”150px” height=”150px” x=”50″, y=”50″/> <image class=”example” href=”https://i.pinimg.com/originals/6f/3d/6a/6f3d6aab605e25af947d804c4a2cb558.jpg” width=”150px” height=”100px” x=”100″, y=”0″/> <!–x value can be changed during time–> </svg> </div>