I made this simple animation. But when I "unhover" the transitioned spans just "disappear". Is there any easy way to slide the spans back, aka. reverse the transition after unhover.
Or if necessary any complicated way?
If possible it would be great if the solution is CSS only.
Thanks in advance!
#container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
#wrapper {
position: relative;
font-family: 'Courier New', Courier, monospace;
}
#wrapper h2 {
font-size: 8rem;
margin: 0px;
}
#wrapper:hover span:first-of-type {
visibility: visible;
transform: translate(0%, 0%);
}
#wrapper:hover span:last-of-type {
transform: translate(0%, 0%);
visibility: visible;
}
#wrapper span {
font-size: 8rem;
font-weight: bold;
transition: transform 1s;
}
#wrapper span:first-of-type {
position: absolute;
top: 0%;
left: 0%;
z-index: 1;
transform: translate(-10%, -100%);
visibility: hidden;
background: linear-gradient(45deg, #00ff00, #00ff80);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
#wrapper span:last-of-type {
position: absolute;
top: 0%;
left: 50%;
z-index: 1;
transform: translate(10%, 100%);
visibility: hidden;
background: linear-gradient(45deg, #00ff80, aqua);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<div id="container">
<div id="wrapper">
<h2>Hi</h2>
<span>H</span>
<span>i</span>
</div>
</div>
Because visibilty cannot be animated smoothly, thus it is recommended to use a scalable value for visibility animation such as opacity.
#container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
#wrapper {
position: relative;
font-family: 'Courier New', Courier, monospace;
}
#wrapper h2 {
font-size: 8rem;
margin: 0px;
}
#wrapper:hover span:first-of-type {
opacity: 1;
transform: translate(0%, 0%);
}
#wrapper:hover span:last-of-type {
transform: translate(0%, 0%);
opacity: 1;
}
#wrapper span {
font-size: 8rem;
font-weight: bold;
transition: transform 1s, opacity 1s;
}
#wrapper span:first-of-type {
position: absolute;
top: 0%;
left: 0%;
z-index: 1;
transform: translate(-10%, -100%);
opacity: 0;
background: linear-gradient(45deg, #00ff00, #00ff80);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
#wrapper span:last-of-type {
position: absolute;
top: 0%;
left: 50%;
z-index: 1;
transform: translate(10%, 100%);
opacity: 0;
background: linear-gradient(45deg, #00ff80, aqua);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<div id="container">
<div id="wrapper">
<h2>Hi</h2>
<span>H</span>
<span>i</span>
</div>
</div>
But if you have to animate visibility for some reason, you may specify the animation-timing-function of visibility to step-end to make it disappear at the last moment:
#wrapper:not(:hover) span {
transition: transform 1s, visibility 1s step-end;
}
#container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
#wrapper {
position: relative;
font-family: 'Courier New', Courier, monospace;
}
#wrapper h2 {
font-size: 8rem;
margin: 0px;
}
#wrapper:hover span:first-of-type {
visibility: visible;
transform: translate(0%, 0%);
}
#wrapper:hover span:last-of-type {
transform: translate(0%, 0%);
visibility: visible;
}
#wrapper span {
font-size: 8rem;
font-weight: bold;
transition: transform 1s;
}
#wrapper span:first-of-type {
position: absolute;
top: 0%;
left: 0%;
z-index: 1;
transform: translate(-10%, -100%);
visibility: hidden;
background: linear-gradient(45deg, #00ff00, #00ff80);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
#wrapper span:last-of-type {
position: absolute;
top: 0%;
left: 50%;
z-index: 1;
transform: translate(10%, 100%);
visibility: hidden;
background: linear-gradient(45deg, #00ff80, aqua);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
/* added */
#wrapper:not(:hover) span {
transition: transform 1s, visibility 1s step-end;
}
<div id="container">
<div id="wrapper">
<h2>Hi</h2>
<span>H</span>
<span>i</span>
</div>
</div>
Related
I worked with this tutorial, and coded this:
Splitting();
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: monospace;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: grey;
}
.circle {
transform-style: preserve-3d;
animation: animate 8s linear infinite;
}
.circle .char {
position: absolute;
top: 0;
left: 0;
background: blue;
color: red;
font-size: 4em;
padding: 5px 12px;
border-top: 4px solid black;
border-bottom: 4px solid black;
transform-style: preserve-3d;
transform-origin: center;
transform: rotateY(calc(var(--char-index) * 12deg)) translateZ(250px);
}
#keyframes animate {
0% {
transform: perspective(1000px) rotateY(360deg) rotateX(15deg);
}
100% {
transform: perspective(1000px) rotateY(0deg) rotateX(15deg);
}
}
<script src="https://unpkg.com/splitting/dist/splitting.min.js"></script>
<div class="circle" data-splitting>
Circle-Text-Animation-Effects-
</div>
Unfortunately, I realized that it doesn't work with Chrome and Firefox. They don't show the curvature. I tried to fix it with Autoprefixer, but it didn't help. Has anyone an idea how to solve this issue?
Here is how it should look like, and how it looks like with Safari:
There is an extra span around your letters that need to have transform-style: preserve-3d;
Splitting();
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: monospace;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: grey;
}
.circle {
transform-style: preserve-3d;
animation: animate 8s linear infinite;
}
/* added this */
.circle > span {
transform-style: preserve-3d;
display: block;
}
/**/
.circle .char {
position: absolute;
top: 0;
left: 0;
background: blue;
color: red;
font-size: 4em;
padding: 5px 12px;
border-top: 4px solid black;
border-bottom: 4px solid black;
transform-style: preserve-3d;
transform-origin: center;
transform: rotateY(calc(var(--char-index) * 12deg)) translateZ(250px);
}
#keyframes animate {
0% {
transform: perspective(1000px) rotateY(360deg) rotateX(15deg);
}
100% {
transform: perspective(1000px) rotateY(0deg) rotateX(15deg);
}
}
<script src="https://unpkg.com/splitting/dist/splitting.min.js"></script>
<div class="circle" data-splitting>
Circle-Text-Animation-Effects-
</div>
I've been fiddling with this code for two days now but whatever I do I can't get this off-canvas nav toggle to take me to the same #section of the website as the normal nav menu.
Here's the html:
<div id="page">
<nav class="fh5co-nav">
<!-- <div class="top-menu"> -->
<div class="container">
<div class="row">
<div class="col-xs-12 text-center logo-wrap">
<div id="fh5co-logo">Woodbridge Art Services</div>
</div>
<div class="col-xs-12 text-center menu-1 menu-wrap">
<ul>
<li class="menu-active"></li>
<li>Consultation</li>
<li>Installation</li>
<li>Sourcing</li>
<li>Transportation</li>
<li>Contact</li>
<li>07905 468747</li>
</ul>
</div>
<!-- </div> -->
</nav>
Here's the css style for the offcanvas:
#fh5co-offcanvas {
position: absolute;
z-index: 1901;
width: 270px;
background: #000 ;
top: 0;
right: 0;
top: 0;
bottom: 0;
padding: 75px 40px 40px 40px;
overflow-y: auto;
display: none;
-moz-transform: translateX(270px);
-webkit-transform: translateX(270px);
-ms-transform: translateX(270px);
-o-transform: translateX(270px);
transform: translateX(270px);
-webkit-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
}
#media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
#fh5co-offcanvas {
background: #000 url(../images/broken_noise.png) repeat;
}
}
#media screen and (max-width: 768px) {
#fh5co-offcanvas {
display: block;
}
}
.offcanvas #fh5co-offcanvas {
-moz-transform: translateX(0px);
-webkit-transform: translateX(0px);
-ms-transform: translateX(0px);
-o-transform: translateX(0px);
transform: translateX(0px);
}
#fh5co-offcanvas a {
color: rgba(255, 255, 255, 0.5);
}
#fh5co-offcanvas a:hover {
color: rgba(255, 255, 255, 0.8);
}
#fh5co-offcanvas ul {
padding: 0;
margin: 0;
}
#fh5co-offcanvas ul li {
padding: 0;
margin: 0;
list-style: none;
}
#fh5co-offcanvas ul li > ul {
padding-left: 20px;
display: none;
}
#fh5co-offcanvas ul li.offcanvas-has-dropdown > a {
display: block;
position: relative;
}
#fh5co-offcanvas ul li.offcanvas-has-dropdown > a:after {
position: absolute;
right: 0px;
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
content: "\ebfc";
font-size: 20px;
color: rgba(255, 255, 255, 0.2);
-webkit-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
}
#fh5co-offcanvas ul li.offcanvas-has-dropdown.active a:after {
-webkit-transform: rotate(-180deg);
-moz-transform: rotate(-180deg);
-ms-transform: rotate(-180deg);
-o-transform: rotate(-180deg);
transform: rotate(-180deg);
}
And here's the script for the toggle:
.fh5co-nav-toggle {
width: 25px;
height: 25px;
cursor: pointer;
text-decoration: none;
top: 25px !important;
}
.fh5co-nav-toggle.active i::before, .fh5co-nav-toggle.active i::after {
background: #444;
}
.fh5co-nav-toggle:hover, .fh5co-nav-toggle:focus, .fh5co-nav-toggle:active {
outline: none;
border-bottom: none !important;
}
.fh5co-nav-toggle i {
position: relative;
display: inline-block;
width: 25px;
height: 2px;
color: #252525;
font: bold 14px/.4 Helvetica;
text-transform: uppercase;
text-indent: -55px;
background: #252525;
transition: all .2s ease-out;
}
.fh5co-nav-toggle i::before, .fh5co-nav-toggle i::after {
content: '';
width: 25px;
height: 2px;
background: #252525;
position: absolute;
left: 0;
transition: all .2s ease-out;
}
.fh5co-nav-toggle.fh5co-nav-black > i {
color: #fff;
background: #fff;
}
.fh5co-nav-toggle.fh5co-nav-black > i::before, .fh5co-nav-toggle.fh5co-nav-black > i::after {
background: #fff;
}
.fh5co-nav-toggle i::before {
top: -7px;
}
.fh5co-nav-toggle i::after {
bottom: -7px;
}
.fh5co-nav-toggle:hover i::before {
top: -10px;
}
.fh5co-nav-toggle:hover i::after {
bottom: -10px;
}
.fh5co-nav-toggle.active i {
background: transparent;
}
.fh5co-nav-toggle.active i::before {
top: 0;
-webkit-transform: rotateZ(45deg);
-moz-transform: rotateZ(45deg);
-ms-transform: rotateZ(45deg);
-o-transform: rotateZ(45deg);
transform: rotateZ(45deg);
background: #fff;
}
.fh5co-nav-toggle.active i::after {
bottom: 0;
-webkit-transform: rotateZ(-45deg);
-moz-transform: rotateZ(-45deg);
-ms-transform: rotateZ(-45deg);
-o-transform: rotateZ(-45deg);
transform: rotateZ(-45deg);
background: #fff;
}
.fh5co-nav-toggle {
position: absolute;
right: 0px;
top: 65px;
z-index: 21;
padding: 6px 0 0 0;
display: block;
margin: 0 auto;
display: none;
height: 44px;
width: 44px;
z-index: 2001;
border-bottom: none !important;
}
#media screen and (max-width: 768px) {
.fh5co-nav-toggle {
display: block;
}
}
At the moment the menu opens and shows the various links yet when you click on them they go to the section of the website they're targetted to however you can't then scroll up or down and when you click on the screen it goes back to the toggle menu. Also the images for each section don't show up...
Look forward to seeing what my glaring failure is in this as I know it'll likely be one line or a <div/> in the wrong place.
Cheers guys
I'm not used to develop much html outside premed templates and now I'm having an awesome opportunity to venture through this.
My Layout https://i.stack.imgur.com/hZJEM.png
I'm having the toughest days of my life tying to put the in codes. Could some good some give a starting point?
I still have no codes for this, I have bunch of codes for trial, but none of them could achieve what I want.
Is there anyone who could help me please?
here is an example of your image with skew column while running the snip will only show code , to see full example please download resources from download link
here is a live view of what is the result
and here is my code which been used for the skew :
position: absolute;
left: 27%;
height: 29in;
transform: rotate(15deg);
top: -200;
text-align: center;
width: 238px;
-ms-transform: skewX(20deg);
-webkit-transform: skewX(20deg);
transform: skewX(-17deg);
transform: rotate(16deg);
width: 21%;
}
download
here an example of skew css code :
$("div").on("click", function() {
$("#menu").toggleClass("active");
});
$("div").on("click", function() {
$(".wrapper").toggleClass("active");
});
#import url("https://fonts.googleapis.com/css?family=Lato:300,800");
.text {
background: transparent;
top: 22%;
right: -100%;
width: 110px;
color: #f7720c;
font-weight: bold;
font-size: 30px;
opacity: 0;
}
.three {
bottom: 0px;
right: 0;
width: 70px;
}
div:hover .one {
right: 90px;
opacity: 0;
}
div:hover .three {
width: 110px;
}
div:hover .text {
right: -11%;
opacity: 1;
}
h1 {
text-align: center;
position: absolute;
top: 10%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #f7720c;
opacity: .04;
font-size: 6em;
font-weight: 800;
text-transform: uppercase;
line-height: .8;
pointer-events: none;
}
#menu {
position: fixed;
z-index: 1000;
width: 100%;
height: 100%;
background: #000000c7;
display: block;
transition: cubic-bezier(0.62,-0.79, 0, 1.71);
-webkit-transform: translate(0, -100%);
transform: translate(0, -100%);
}
#menu .wrapper {
opacity: 0;
-webkit-transform: translate(0, 40px);
transform: translate(0, 40px);
padding-top: 20vh;
width: 100%;
height: 100%;
text-align: center;
transition: all .4s ease-in-out;
}
#menu .wrapper ul {
list-style-type: none;
text-align: center;
color: #fff;
}
#menu .wrapper ul li:first-child {
padding-top: 0;
}
#menu .wrapper ul li {
padding-top: 1.5em;
}
#menu .wrapper a {
text-decoration: none;
font-size: 3em;
font-weight: 800;
color: #f3f3f3;
transition: color .3s ease-in-out;
}
#menu .wrapper a:hover {
color: #f7720c;
}
#menu.active {
-webkit-transform: translate(0, 0%);
transform: translate(0, 0%);
height: 100%;
transition-delay: .2s;
}
#menu .active {
-webkit-transform: translate(0, 0px);
transform: translate(0, 0px);
transition-delay: .45s;
opacity: 1;
}
/* Main styles */
#import url(https://fonts.googleapis.com/css?family=Open+Sans:800);
.box-with-text {
background-image: url('https://unsplash.imgix.net/photo-1433354359170-23a4ae7338c6?fit=crop&fm=jpg&h=700&q=75&w=1050');
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
}
.box-with-text {
position: relative;
margin-top:50px;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background-repeat: repeat;
background-position: 50% 50%;
background-size: cover;
white-space: nowrap;
text-align: center;
text-transform: uppercase;
font-size:95px;
font-family:Oswald, Impact;
}
.box-with-text-2 {
background-image: -webkit-linear-gradient(seagreen 50%, lightseagreen 80%);
background-repeat: repeat;
background-position: 0 0;
background-size: 100% 50px;
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
-webkit-animation: stripes 2s linear infinite;
animation: stripes 2s linear infinite;
}
#-webkit-keyframes stripes {
100% {
background-position: 0 -50px;
}
}
#keyframes stripes {
100% {
background-position: 0 -50px;
}
}
.box-with-text-2 {
position: relative;
display:block;
margin-top:50px;
left: 50%;
white-space: nowrap;
text-align: center;
text-transform: uppercase;
font-size:82px;
font-family: bold Open Sans, Impact;
-webkit-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
/* Main styles */
#import url(https://fonts.googleapis.com/css?family=Open+Sans:800);
.text {
fill: none;
stroke-width: 6;
stroke-linejoin: round;
stroke-dasharray: 70 330;
stroke-dashoffset: 0;
-webkit-animation: stroke 6s infinite linear;
animation: stroke 6s infinite linear;
}
.text:nth-child(5n + 1) {
stroke: #F2385A;
-webkit-animation-delay: -1.2s;
animation-delay: -1.2s;
}
.text:nth-child(5n + 2) {
stroke: #F5A503;
-webkit-animation-delay: -2.4s;
animation-delay: -2.4s;
}
.text:nth-child(5n + 3) {
stroke: #E9F1DF;
-webkit-animation-delay: -3.6s;
animation-delay: -3.6s;
}
.text:nth-child(5n + 4) {
stroke: #56D9CD;
-webkit-animation-delay: -4.8s;
animation-delay: -4.8s;
}
.text:nth-child(5n + 5) {
stroke: #3AA1BF;
-webkit-animation-delay: -6s;
animation-delay: -6s;
}
#-webkit-keyframes stroke {
100% {
stroke-dashoffset: -400;
}
}
#keyframes stroke {
100% {
stroke-dashoffset: -400;
}
}
/* Other styles */
svg {
position: absolute;
left:0;
right:0;
width: 250px;
height: 250px;
margin:0 auto;
}
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Exo+2:600,700,800,900' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="stylesheet" href="css/styletxt.css">
<link rel="stylesheet" href="./css/styletxt.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="./css/style.css">
<style>
.bodybg {
font-family: helvetica, arial, sans-serif;
background-image: url(./background.png);
height: 90%;
width: 100%;
background-size: cover;
overflow: hidden;
z-index: 1;
background-repeat: no-repeat;
background-color: black;
position: absolute;
left: 0;
top: 5%;
box-shadow: -1px -3px 20px 0px #333333fa;}
.col {
background: #ddd;
width: 33%;
height: 100%;
float: left;
position: relative;
cursor: pointer;
-moz-transform: skew(-5deg, 0deg);
-webkit-transform: skew(-5deg, 0deg);
-o-transform: skew(-5deg, 0deg);
-ms-transform: skew(-5deg, 0deg);
transform: skew(-5deg, 0deg);
-webkit-transition: all 200ms ease-in-out;
-moz-transition: all 200ms ease-in-out;
-ms-transition: all 200ms ease-in-out;
-o-transition: all 200ms ease-in-out;
transition: all 200ms ease-in-out;
}
.col:first-of-type {
background: #fff;
margin-left: -50px;
padding-left: 50px;
}
.col:last-of-type {
background: #f7d00c;
margin-right: -50px;
padding-right: 50px;
}
.col:hover {
background: #900;
color: #fff;
}
.col-content {
position: absolute;
width: calc(100% - 40px);
bottom: 0;
padding: 20px;
text-align: center;
-webkit-transform: skew(5deg, 0deg);
-moz-transform: skew(5deg, 0deg);
-ms-transform: skew(5deg, 0deg);
-o-transform: skew(5deg, 0deg);
transform: skew(5deg, 0deg);
}
.col:first-of-type .col-content,
.col:last-of-type .col-content {
width: calc(100% - 90px);
}
}
#import url('https://fonts.googleapis.com/css?family=Lato:300,800');
$menu-bg-color: #f7580;
$content-color: #f7580;
$background-color: #f3f3f3;
$links: #f3f3f3;
body {
display: flex;
// flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
background: $background-color;
font-family: 'Lato', sans-serif;
}
div {
position: relative;
height: 60px;
width: 110px;
cursor: pointer;
}
span {
width: 110px;
height: 7px;
background: $content-color;
position: absolute;
transition: all .4s ease-in-out;
}
.text {
background: transparent;
top: 22%;
right: -100%;
width: 110px;
color: $content-color;
font-weight: bold;
font-size: 30px;
opacity: 0;
}
.one {
top: 50%;
right: 0;
width: 90px;
transform: translate(0%, -50%);
}
.three {
bottom: 0px;
right: 0;
width: 70px;
}
div:hover .one {
right: 90px;
opacity: 0;
}
div:hover .three {
width: 110px;
}
div:hover .text {
right: -11%;
opacity: 1;
}
h1 {
text-align: center;
position: absolute;
top: 10%;
left: 50%;
transform: translate(-50%,-50%);
color: $content-color;
opacity: .04;
font-size: 6em;
font-weight: 800;
text-transform: uppercase;
line-height: .8;
pointer-events:none;
}
// menu styling
#menu {
position: fixed;
z-index: 1000;
width: 100%;
height: 100%;
background: $menu-bg-color;
display: block;
transition: all .3s ease-in-out;
transform: translate(0, -100%);
.wrapper {
opacity: 0;
transform: translate(0, 40px);
padding-top: 20vh;
width: 100%;
height: 100%;
text-align: center;
transition: all .4s ease-in-out;
ul {
list-style-type: none;
text-align: center;
color: #fff;
}
ul li:first-child {
padding-top: 0;
}
ul li {
padding-top: 1.5em;
}
a {
text-decoration: none;
font-size: 3em;
font-weight: 800;
color: $links;
transition: color .3s ease-in-out;
&:hover {
color: darken($links, 25%);
}
}
}
}
#menu.active {
transform: translate(0, 0%);
height: 100%;
transition-delay: .2s;
}
#menu .active {
transform: translate(0, 0px);
transition-delay: .45s;
opacity: 1;
}
.menuinteract{
position:absolute;right:6%;top:4%;z-index:88888;height:100px; background-image:url("./menudisabled.png");
background-size:cover;
}
.menuinteract:hover{
position:absolute; right:6%; top:4%;z-index:88888;height:100px; background-image:url("./clicked.png");
background-size:cover;}
</style>
<script>
$("div").on("click", function() {
$("#menu").toggleClass("active");
});
$("div").on("click", function() {
$(".wrapper").toggleClass("active");
});
</script>
</head>
<body style="overflow:hidden;background-color:black">
<div class="menuinteract" "
<div>
<span class="one"></span>
<span class="two"></span>
<span class="three"></span>
<span class="text">MENU</span>
</div>
<nav id="menu">
<div class="wrapper">
<ul>
<li>About</li>
<li>Work</li>
<li>Journal</li>
<li>Contact</li>
</ul>
</div>
</nav>
<div style="height: 100%;width: 100%;text-align:center;">
<div class="bodybg">
<div class="col" style="position: absolute;
left: 17%;
height: 29in;
transform: rotate(15deg);
top: -200;
text-align: center;
width: 238px;
-ms-transform: skewX(20deg);
-webkit-transform: skewX(20deg);
transform: skewX(-17deg);
transform: rotate(16deg);
width: 21%;">
<div class="col-content">
</div>
<div style="position:absolute; top:5%;z-index:10000;">
<!-- animated txt here >
<svg viewBox="0 0 600 300">
<!-- Symbol -->
<symbol id="s-text">
<text text-anchor="middle" x="50%" y="50%" dy=".35em">
|SL|
</text>
</symbol>
<!-- <svg viewBox="0 0 600 300">
<!-- Symbol -->
<symbol id="s-text">
<text text-anchor="middle"
x="50%" y="50%" dy=".35em">
|SL|
</text>
</symbol>
<!-- Duplicate symbols -->
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
></use>
</svg>
</div>
-->
</div>
</div>
</body>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src="js/index.js"></script>
</html>
I have a situation where I am modifying an element using a hover pseudo class both when its parent is hovered over and when it is hover over. Unfortunately, they have a conflicting property (both trying to define the property transform), which is why -- I assume -- the scaling is not working when the button is hovered over but the cursor change is. Is there a work around using just CSS?
body {
overflow: hidden;
}
#action-panel {
align-items: center;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px 20px 20px 20px;
position: absolute;
right: 0;
transform: translateY(-50%);
top: 50%;
}
#action-panel:hover .action-button {
opacity: 1;
transform: translateX(0);
}
.action-button {
background-color: lightblue;
border-radius: 25px;
height: 50px;
margin-bottom: 20px;
opacity: 0;
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
transform: translateX(calc(100% + 20px));
width: 50px;
}
.action-button:hover {
cursor: pointer;
transform: translateX(0) scale(1.2);
}
.action-button span {
font-size: 30px;
left: 50%;
position: relative;
transform: translate(-50%, -50%);
top: 50%;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div id="action-panel">
<div class="action-button"><span class="material-icons">3d_rotation</span></div>
<div class="action-button"><span class="material-icons">compare_arrows</span></div>
<div class="action-button"></div>
</div>
Note:
If you cannot tell from the code, you need to move your cursor to the middle of the right edge to see the effects I am describing.
Increased the specificity of the following style by adding #action-panel before it. In your code the hover styles of parent were overriding the hover styles of child.
#action-panel .action-button:hover {
cursor: pointer;
transform: translateX(0) scale(1.2);
}
body {
overflow: hidden;
}
#action-panel {
align-items: center;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px 20px 20px 20px;
position: absolute;
right: 0;
transform: translateY(-50%);
top: 50%;
}
#action-panel:hover .action-button {
opacity: 1;
transform: translateX(0);
}
.action-button {
background-color: lightblue;
border-radius: 25px;
height: 50px;
margin-bottom: 20px;
opacity: 0;
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
transform: translateX(calc(100% + 20px));
width: 50px;
}
#action-panel .action-button:hover {
cursor: pointer;
transform: translateX(0) scale(1.2);
}
.action-button span {
font-size: 30px;
left: 50%;
position: relative;
transform: translate(-50%, -50%);
top: 50%;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div id="action-panel">
<div class="action-button"><span class="material-icons">3d_rotation</span></div>
<div class="action-button"><span class="material-icons">compare_arrows</span></div>
<div class="action-button"></div>
</div>
I'm working on an onhover text translate animation.
I've seen most responses to this question on StackOverflow/Google, and have tried to apply all the fixes, but none of them seem to work.
In firefox, it's just the -moz-transform: translate3d(0,-200px,0);that blurs, but in Chrome the entire time it's blurred.
Here's the fiddle I'm working on.
Option 1
Try this hexagon for smoother text
.hexagon {
position: relative;
width: 300px;
height: 173.21px;
margin: 86.60px 0;
background-image: url(https://0.s3.envato.com/files/53859088/Green-Leaf-Texture_01-1_Preview.jpg);
background-size: auto 346.4102px;
background-position: center;
cursor: pointr;
}
.hexTop,
.hexBottom {
position: absolute;
z-index: 1;
width: 212.13px;
height: 212.13px;
overflow: hidden;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background: inherit;
left: 43.93px;
}
/*counter transform the bg image on the caps*/
.hexTop:after,
.hexBottom:after {
content: "";
position: absolute;
width: 300.0000px;
height: 173.20508075688775px;
-webkit-transform: rotate(45deg) scaleY(1.7321) translateY(-86.6025px);
-ms-transform: rotate(45deg) scaleY(1.7321) translateY(-86.6025px);
transform: rotate(45deg) scaleY(1.7321) translateY(-86.6025px);
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
background: inherit;
}
.hexTop {
top: -106.0660px;
}
.hexTop:after {
background-position: center top;
}
.hexBottom {
bottom: -106.0660px;
}
.hexBottom:after {
background-position: center bottom;
}
.hexagon:after {
content: "";
position: absolute;
top: 0.0000px;
left: 0;
width: 300.0000px;
height: 173.2051px;
z-index: 2;
background: inherit;
}
.text {
position: absolute;
top: 220px;
left: 80px;
right: 0;
bottom: 0;
font-size: 2.6em;
color: #000;
z-index: 999;
opacity: 0;
transition: all ease 0.6s;
}
.hexagon:hover .text {
opacity: 1;
top: 70px;
}
.hexagon:hover {
background-color: #fff;
}
<div class="hexagon">
<div class="hexTop"></div>
<div class="hexBottom"></div>
<div class="text">Option1</div>
</div>
Option 2
Use this example its responsive
http://codepen.io/web-tiki/pen/HhCyd
body {
font-family: 'Open Sans', arial, sans-serif;
background: #fff;
}
* {
margin: 0;
padding: 0;
}
#categories {
overflow: hidden;
width: 90%;
margin: 0 auto;
}
.clr:after {
content: "";
display: block;
clear: both;
}
#categories li {
position: relative;
list-style-type: none;
width: 27.85714285714286%;
/* = (100-2.5) / 3.5 */
padding-bottom: 32.16760145166612%;
/* = width /0.866 */
float: left;
overflow: hidden;
visibility: hidden;
-webkit-transform: rotate(-60deg) skewY(30deg);
-ms-transform: rotate(-60deg) skewY(30deg);
transform: rotate(-60deg) skewY(30deg);
}
#categories li:nth-child(3n+2) {
margin: 0 1%;
}
#categories li:nth-child(6n+4) {
margin-left: 0.5%;
}
#categories li:nth-child(6n+4),
#categories li:nth-child(6n+5),
#categories li:nth-child(6n+6) {
margin-top: -6.9285714285%;
margin-bottom: -6.9285714285%;
-webkit-transform: translateX(50%) rotate(-60deg) skewY(30deg);
-ms-transform: translateX(50%) rotate(-60deg) skewY(30deg);
transform: translateX(50%) rotate(-60deg) skewY(30deg);
}
#categories li * {
position: absolute;
visibility: visible;
}
#categories li > div {
width: 100%;
height: 100%;
text-align: center;
color: #fff;
overflow: hidden;
-webkit-transform: skewY(-30deg) rotate(60deg);
-ms-transform: skewY(-30deg) rotate(60deg);
transform: skewY(-30deg) rotate(60deg);
-webkit-backface-visibility: hidden;
}
/* HEX CONTENT */
#categories li img {
left: -100%;
right: -100%;
width: auto;
height: 100%;
margin: 0 auto;
}
#categories div h1,
#categories div p {
width: 90%;
padding: 0 5%;
background-color: #008080;
background-color: rgba(0, 0, 0, 0.5);
font-family: 'Raleway', sans-serif;
-webkit-transition: top .2s ease-out, bottom .2s ease-out, .2s padding .2s ease-out;
-ms-transition: top .2s ease-out, bottom .2s ease-out, .2s padding .2s ease-out;
transition: top .2s ease-out, bottom .2s ease-out, .2s padding .2s ease-out;
}
#categories li h1 {
bottom: 110%;
font-style: italic;
font-weight: normal;
font-size: 1em;
padding-top: 100%;
padding-bottom: 100%;
}
#categories li h1:after {
content: '';
display: block;
position: absolute;
bottom: -1px;
left: 45%;
width: 10%;
text-align: center;
z-index: 1;
border-bottom: 2px solid #fff;
}
#categories li p {
padding-top: 50%;
top: 110%;
padding-bottom: 50%;
}
/* HOVER EFFECT */
#categories li div:hover h1 {
bottom: 50%;
padding-bottom: 10%;
}
#categories li div:hover p {
top: 50%;
padding-top: 10%;
}
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,800italic,400,700,800' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Raleway:400,700,300,200,100,900' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Amatic+SC:400,700' rel='stylesheet' type='text/css'>
<ul id="categories" class="clr">
<li class="pusher"></li>
<li>
<div>
<img src="https://0.s3.envato.com/files/53859088/Green-Leaf-Texture_01-1_Preview.jpg" alt="" />
<h1>Option 1</h1>
<p>Some sample text about the article this hexagon leads to</p>
</div>
</li>
<li>
<div>
<img src="https://0.s3.envato.com/files/53859088/Green-Leaf-Texture_01-1_Preview.jpg" alt="" />
<h1>Option 2</h1>
<p>Some sample text about the article this hexagon leads to</p>
</div>
</li>
<li>
<div>
<img src="https://0.s3.envato.com/files/53859088/Green-Leaf-Texture_01-1_Preview.jpg" alt="" />
<h1>Option 3</h1>
<p>Some sample text about the article this hexagon leads to</p>
</div>
</li>
</ul>