In Firefox the clickable area of my circular buttons seems to extend outside of the circle in the shape of a square. This does not happen in Chrome/Safari, which display everything properly.
There's a "rotate on hover" feature over the buttons and this glitch is especially evident when hovering diagonally over the bottom left/right corner of the buttons and moving to the center. Anyone have any idea how to fix this?
Test-site: http://parkerrichard.com/new/index.html
HTML
<nav class="centered" role="navigation">
<div class="container">
<div class="centered">
<ul>
<li>
<button class="design"></button>
</li>
<li>
<button class="photo"></button>
</li>
<li>
<button class="music"></button>
</li>
<li>
<button class="art"></button>
</li>
<li>
<button class="parker"></button>
</li>
</ul>
</div>
</div><!--/container -->
</nav><!--/navbar -->
CSS
nav {
margin-top: 20px;
margin-bottom: 80px;
}
nav ul {
list-style: none;
margin: 10px 0 0 -30px;
}
nav li a {
font-size: 25px;
}
nav button {
width: 100%;
opacity: .1;
transition: opacity .7s ease-out;
-moz-transition: opacity .7s ease-out;
-webkit-transition: opacity .7s ease-out;
-o-transition: opacity .7s ease-out;
}
nav button:hover {
opacity: .5;
}
.art:hover, .music:hover, .photo:hover, .design:hover {
-webkit-animation:spin 2s ease;
-moz-animation:spin 2s ease;
animation:spin 2s ease;
}
#-moz-keyframes spin { 10% { -moz-transform: rotate(18deg); } }
#-webkit-keyframes spin { 10% { -webkit-transform: rotate(18deg); } }
#keyframes spin { 10% { -webkit-transform: rotate(18deg); transform:rotate(18deg); } }
nav button {
border-radius:50%;
position: absolute;
opacity: 50% !important;
left: 50%;
right: 50%;
}
.parker {
margin-top: 196px;
margin-left: -100px;
width: 200px;
height: 200px;
background: transparent url('../img/parker.jpg');
background-size: 100%;
opacity: 1 !important;
}
.art {
margin-top: 144px;
margin-left: -150px;
width: 300px;
height: 300px;
background: transparent url('../img/art.jpg');
}
.music {
margin-top: 96px;
margin-left: -198px;
width: 400px;
height: 400px;
background: transparent url('../img/music.jpg');
}
.photo {
margin-top: 48px;
margin-left: -248px;
width: 500px;
height: 500px;
background: transparent url('../img/photo.jpg');
}
.design {
margin-left: -296px;
width: 600px;
height: 600px;
background: transparent url('../img/design.jpg');
}
Firefox seems to have a problem with border-radius on button elements (something which was a problem in webkit browsers in the past aswell, see: Button border radius and cursor). This will probably get fixed in a future version, but I would suggest using divs instead.
The following should work (here also a codepen):
nav {
margin-top: 20px;
margin-bottom: 80px;
}
nav ul {
list-style: none;
margin: 10px 0 0 -30px;
}
nav li a {
font-size: 25px;
}
nav li div {
width: 100%;
opacity: .1;
transition: opacity .7s ease-out;
-moz-transition: opacity .7s ease-out;
-webkit-transition: opacity .7s ease-out;
-o-transition: opacity .7s ease-out;
}
nav li div:hover {
opacity: .5;
}
.art:hover, .music:hover, .photo:hover, .design:hover {
-webkit-animation:spin 2s ease;
-moz-animation:spin 2s ease;
animation:spin 2s ease;
}
#-moz-keyframes spin { 10% { -moz-transform: rotate(18deg); } }
#-webkit-keyframes spin { 10% { -webkit-transform: rotate(18deg); } }
#keyframes spin { 10% { -webkit-transform: rotate(18deg); transform:rotate(18deg); } }
nav li div {
border-radius:50%;
position: absolute;
opacity: 50% !important;
left: 50%;
right: 50%;
}
.parker {
margin-top: 196px;
margin-left: -100px;
width: 200px;
height: 200px;
background: transparent url('http://parkerrichard.com/new/img/parker.jpg');
background-size: 100%;
opacity: 1 !important;
}
.art {
margin-top: 144px;
margin-left: -150px;
width: 300px;
height: 300px;
background: transparent url('http://parkerrichard.com/new/img/art.jpg');
}
.music {
margin-top: 96px;
margin-left: -198px;
width: 400px;
height: 400px;
background: transparent url('http://parkerrichard.com/new/img/music.jpg');
}
.photo {
margin-top: 48px;
margin-left: -248px;
width: 500px;
height: 500px;
background: transparent url('http://parkerrichard.com/new/img/photo.jpg');
}
.design {
margin-left: -296px;
width: 600px;
height: 600px;
background: transparent url('http://parkerrichard.com/new/img/design.jpg');
}
<nav class="centered" role="navigation">
<div class="container">
<div class="centered">
<ul>
<li>
<div class="design"></div>
</li>
<li>
<div class="photo"></div>
</li>
<li>
<div class="music"></div>
</li>
<li>
<div class="art"></div>
</li>
<li>
<div class="parker"></div>
</li>
</ul>
</div>
</div><!--/container -->
</nav><!--/navbar -->
Related
I have created animation that runs hover the link.
I have created animation using in and out key frames.
But I got issue. I think this happens because of knight-rider-out animation. But I need that for mouse leave.
The issue is when the page load it is running automatically. Code pen link
.container {
padding: 50px;
max-width: 500px;
}
.dashBottom {
padding-left: 0px;
position: relative;
padding-bottom: 15px;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
color: black;
text-decoration: none;
}
.dashBottom:after {
position: absolute;
content: "";
bottom: 0px;
width: 30px;
background-color: black;
height: 4px;
left: 0;
right: auto;
-webkit-animation: knight-rider-out 0.5s;
animation: knight-rider-out 0.5s;
animation-fill-mode: forwards;
}
.dashBottom:hover:after {
-webkit-animation: knight-rider-in 0.5s;
animation: knight-rider-in 0.5s;
animation-fill-mode: forwards;
}
#keyframes knight-rider-in {
from {
left: 0px;
width: 30px;
}
50% {
left: 0px;
width: 100%;
}
to {
left: calc( 100% - 30px);
width: 30px;
}
}
#keyframes knight-rider-out {
from {
left: calc( 100% - 30px);
width: 30px;
}
50% {
left: 0px;
width: 100%;
}
to {
left: 0px;
width: 30px;
}
}
<div class="container">
<a class="viewMore dashBottom" href="#">View More</a>
</div>
To avoid this you can consider transition. Here is another way to achieve the same effect with less of code:
.container {
padding: 50px;
max-width: 500px;
}
.dashBottom {
padding-left: 0px;
position: relative;
padding-bottom: 15px;
transition: all 0.3s;
color: black;
text-decoration: none;
background-image:linear-gradient(#000,#000);
background-size: 200% 4px;
background-position: calc(200% + 30px) 100%;
background-repeat:no-repeat;
transition:0.5s all;
}
.dashBottom:hover {
background-position:calc(-100% - 30px) 100%;
}
<div class="container">
<a class="viewMore dashBottom" href="#">View More</a>
</div>
Hi I have a problem trying to getting the animation at the left hand side of the button when user mouse over the button. One of the example that explain as below:
HTML:
<div class="block">
<div class="normal">
<span>Follow me...</span>
</div>
<a target="_BLANK" class="hover" href="http://twitter.com/benoitboucart" title="My twitter profile">
on Twitter
</a>
CSS:
/**
* CSS3 balancing hover effect
* Read the tutorial here: http://webbb.be/blog/little-css3-3d-hover-effects/
*/
body {background: #f06;background: linear-gradient(45deg, #f06, yellow);min-height: 100%;}
.block {
width: 150px; color: #fff; margin: 30px auto; text-transform: uppercase; text-align: center; font-family: Helvetica;
position: relative;
perspective: 350;
}
.block .normal {
background: gray; padding: 15px; cursor: pointer;
position:relative; z-index:2;
}
.block .hover {
background: #00aced; margin-top:-48px; padding: 15px; display: block; color: #fff; text-decoration: none;
position: relative; z-index:1;
transition: all 250ms ease;
}
.block:hover .normal {
background: #0084b4;
}
.block:hover .hover {
margin-right: 0;
transform-origin: top;
/*
animation-name: balance;
animation-duration: 1.5s;
animation-timing-function: ease-in-out;
animation-delay: 110ms;
animation-iteration-count: 1;
animation-direction: alternate;
*/
animation: balance 1.5s ease-in-out 110ms 1 alternate;
}
#keyframes balance {
0% { margin-top: 0; }
15% { margin-top: 0; transform: rotateX(-50deg); }
30% { margin-top: 0; transform: rotateX(50deg); }
45% { margin-top: 0; transform: rotateX(-30deg); }
60% { margin-top: 0; transform: rotateX(30deg); }
75% { margin-top: 0; transform: rotateX(-30deg); }
100% { margin-top: 0; transform: rotateX(0deg);}
}
https://jsfiddle.net/9dwk8vzg/
Original link:http://dabblet.com/gist/5559193
But for this example is at the bottom instated of at the left hand side of the button, I tried using margin-right and padding-left still unable to get the mouse over appeal div tag to be on the right hand side, may I know what do I miss to get the div tag to appeal on the right hand side/
/**
* CSS3 balancing hover effect
* Read the tutorial here: http://webbb.be/blog/little-css3-3d-hover-effects/
*/
body {background: #f06;background: linear-gradient(45deg, #f06, yellow);min-height: 100%;}
.block {
width: 150px; color: #fff; margin: 30px auto; text-transform: uppercase; text-align: center; font-family: Helvetica;
position: relative;
perspective: 350;
}
.block .normal {
width: 100%;
background: gray; padding: 15px; cursor: pointer;
position:relative; z-index:2;
}
.block .hover {
width: 100%;
background: #00aced;
padding: 15px;
display: block;
position:absolute;
color: #fff;
text-decoration: none;
z-index:1;
transition: all 250ms ease;
right: -30px;
top: 0;
}
.block:hover .normal {
background: #0084b4;
}
.block:hover .hover {
right: 100%;
transform-origin: top;
/*
animation-name: balance;
animation-duration: 1.5s;
animation-timing-function: ease-in-out;
animation-delay: 110ms;
animation-iteration-count: 1;
animation-direction: alternate;
*/
animation: balance 1.5s ease-in-out 110ms 1 alternate;
}
#keyframes balance {
15% { width: 95%; }
30% { width: 105%; }
45% { width: 97%; }
60% { width: 103%; }
75% { width: 97%; }
100% { width: 100%; }
}
<div class="block">
<div class="normal">
<span>Follow me...</span>
</div>
<a target="_BLANK" class="hover" href="http://twitter.com/benoitboucart" title="My twitter profile">
on Twitter
</a>
</div>
So I have this page with a nav bar, and on the nav bar, there is a img logo on the left and 3 links on the right. And when I test responsiveness with devices on Chrome, the nav bar resizes and shifts to the left, leaving a blank space on it's right. Here's a picture Nav bar not displaying fully
And here is all my code:
#font-face {
font-family: coyote;
src: url(font/coyote.ttf);
}
html {
width: 100%;
height: 100%;
}
* {
margin: 0;
padding: 0;
}
body {
overflow: hidden;
margin: 0;
padding: 0;
}
nav {
background: #efefef;
overflow: hidden;
box-shadow: -2px -7px 47px 9px rgba(0, 0, 0, 0.35);
-moz-box-shadow: -2px -7px 47px 9px rgba(0, 0, 0, 0.35);
-webkit-box-shadow: -2px -7px 47px 9px rgba(0, 0, 0, 0.35);
z-index: 999;
margin: 0;
padding: 0;
}
.logo-section {
float: left;
padding: 25px;
font-family: serif;
}
.logo-left {
width: 12%;
float: left;
overflow: none;
display: block;
margin: auto;
transform: translateY(20%);
}
.hb-button {
float: right;
background-color: rgba(0, 0, 255, 0);
color: black;
border: none;
font-size: 18px;
padding: 9px 10px;
border-radius: 3px;
cursor: pointer;
display: none;
outline: none;
}
nav a {
text-decoration: none;
color: #282828;
font-size: 16px;
}
nav ul {
overflow: hidden;
color: #fff;
margin: 0;
height: 68px;
text-align: center;
transition: max-height 0.5s;
-webkit-transition: max-height 0.5s;
-moz-transition: max-height 0.5s;
-ms-transition: max-height 0.5s;
-o-transition: max-height 0.5s;
}
nav ul li {
float: right;
display: inline-block;
font-family: coyote;
}
li > a {
color: #000;
text-decoration: none;
transition-timing-function: ease-in-out;
}
li > a:hover {
color: #CF2034;
transition: color .7s cubic-bezier(0.11, 0.7, 0, 1);
-o-transition: color .7s cubic-bezier(0.11, 0.7, 0, 1);
-moz-transition: color .7s cubic-bezier(0.11, 0.7, 0, 1);
-webkit-transition: color .7s cubic-bezier(0.11, 0.7, 0, 1);
transition-timing-function: ease-in-out;
}
li > a:after {
position: absolute;
bottom: 0;
left: 0;
display: block;
width: 100%;
height: 2px;
background-color: #CF2034;
content: "";
transform: scale(0);
-o-transition: transform 1s cubic-bezier(0.11, 0.7, 0, 1);
-moz-transition: transform 1s cubic-bezier(0.11, 0.7, 0, 1);
-webkit-transition: transform 1s cubic-bezier(0.11, 0.7, 0, 1);
transition: transform 1s cubic-bezier(0.11, 0.7, 0, 1);
transition-timing-function: ease-in-out;
}
li > a:hover:after {
transform: scale(1);
}
.image-cont {
position: absolute;
min-width: 45%;
min-height: 45%;
top: 55%;
left: 50%;
overflow: visible;
}
.image {
animation: load_up 2s forwards;
-webkit-animation: load_up 2s forwards;
-moz-animation: load_up 2s forwards;
-o-animation: load_up 2s forwards;
margin-top: -50%;
margin-left: -50%;
position: relative;
}
.image-cont2 {
position: absolute;
top: 35%;
left: 50%;
overflow: visible;
}
.image2 {
display: none;
animation: load_up 2s forwards;
-webkit-animation: load_up 2s forwards;
-moz-animation: load_up 2s forwards;
-o-animation: load_up 2s forwards;
}
#media screen and (max-device-width: 1603px) and (min-device-width: 1081px) {
* {
margin: 0;
padding: 0;
}
header {
padding: 0;
margin: 0;
}
nav {
margin: 0;
padding: 0;
width: 100%;
}
nav ul {
margin: 0;
padding: 0;
z-index: 99999;
}
nav ul li {
margin 0;
}
}
#media screen and (max-device-width: 1080px) {
.logo-section {
float: none;
}
nav ul {
background: #ffffff;
max-height: 0px;
height: 0;
}
nav ul.show {
max-width: 100%;
max-height: 100%;
z-index: 9999;
height: 100%;
width: 100%;
}
nav ul li {
box-sizing: border-box;
width: 100%;
height: 100%;
padding: 15px;
padding-left: 25%;
text-align: center;
}
nav a {
display: block;
}
.hb-button {
display: inline;
}
.image {
display: none;
}
.image2 {
display: block;
margin-top: -35%;
margin-left: -50%;
}
.logo-left {
transform: translateY(-65%);
padding-left: 15px;
width: 10%;
}
}
#keyframes load_up {
0% {
opacity: 0;
transform: translateY(11%);
}
100% {
opacity: 1;
transform: translateY(0px);
}
}
#-webkit-keyframes load_up {
0% {
opacity: 0;
transform: translateY(11%);
}
100% {
opacity: 1;
transform: translateY(0px);
}
}
#-moz-keyframes load_up {
0% {
opacity: 0;
transform: translateY(11%);
}
100% {
opacity: 1;
transform: translateY(0px);
}
}
#-o-keyframes load_up {
0% {
opacity: 0;
transform: translateY(11%);
}
100% {
opacity: 1;
transform: translateY(0px);
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/responsive_navbar.js"></script>
<link rel="stylesheet" href="main.css">
<header>
<nav>
<div class="logo-section">
<button class="hb-button"><i class="fa fa-bars" aria-hidden="true"></i>
</button>
</div>
<div style="min-width: 1920px; margin: 0 auto;">
<a href="index.html"><img src="img/thermocase.png" class="logo-left">
</a>
</div>
<ul>
<li> ● Contact Us
</li>
<li> ● The Team
</li>
<li> ● Our Product
</li>
</ul>
</nav>
</header>
<div class="image-cont">
<img src="img/iphone.png" class="image" />
</div>
<div class="image-cont2">
<img src="img/iphone2.png" class="image2" />
</div>
Thanks for taking a look. Fyi, I'm new to this.
Two things you could start with.
You need to have your opening <body> tag immediately after your closing </head> tag, so you might want to consider using another div to wrap the main content on your page
<html>
<head> ... </head>
<body>
<header> ... </header>
<div class="main-content"> ... </div>
</body>
</html>
Secondly, at line 19 of your HTML you have
<div style="min-width: 1920px; margin: 0 auto;">
Hard coding the width of an element like this is going to give you a hard time once the viewport is less that 1920px. You might want to remove this inline CSS, and replace it with a class. Then you can easily manipulate the width of the div using CSS media queries, e.g.
HTML
<div class="logo-wrap"> ... </div>
CSS
.logo-wrap{
...
}
#media (min-width: 1920px) {
min-width: 1920px;
margin: 0 auto;
}
Edit
Try changing your viewport meta tag to
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
Good luck!
I want to rotate the inner circle when hover over outer circle, its works fine if I don't apply animation to it. But if I apply animation, inner circle does not rotate on hover. My animation makes inner circle rotate once only.
body, html {
height: 100%;
}
.main-content {
position: relative;
height: 100%;
}
.box-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.box-container ul {
list-style: none;
}
.box-container .box {
display: inline-block;
height: 100px;
width: 100px;
background: pink;
border-radius: 50%;
text-align: center;
position: relative;
cursor: pointer;
}
.box-container .box span {
transform-origin: 0% 0%;
position: absolute;
top: 50%;
left: 50%;
border-radius: 50%;
margin-top: -20px;
margin-left: -20px;
display: block;
width: 40px;
height: 40px;
background: #58C9B9;
color: #fff;
line-height: 40px;
text-align: center;
transform-origin: calc(100% - 20px) calc(100% - 20px);
}
.box-container .box:hover span {
background: #4F86C6;
transform: rotateY(360deg);
transition: .5s;
}
.animate1 {
animation: animate .5s ease-in-out forwards;
}
.animate2 {
animation: animate .5s ease-in-out .5s forwards;
}
.animate3 {
animation: animate .5s ease-in-out 1.0s forwards;
}
#keyframes animate {
0% {
opacity: 0;
transform: rotateY(0deg);
}
100% {
opacity: 1;
transform: rotateY(360deg);
}
}
<div class="main-content">
<div class="box-container">
<ul class="list-unstyle list-inline">
<li class="box "><span class="animate1">20%</span></li>
<li class="box "><span class="animate2">40%</span></li>
<li class="box "><span class="animate3">50%</span></li>
</ul>
</div>
</div>
<div>
Remove property forwards from animation-fill-mode and then it works fine, as below.
animation-fill-mode:forwards - After the animation ends,
the animation will apply the property values for the time the animation ended.
Over-here animation ends at 360deg when using forwards.
Update -
And in your case you need to use forwards just to fade-in span tag i.e. from opacity 0 to 1, so for that you can declare two different animation.
body, html {
height: 100%;
}
.main-content {
position: relative;
height: 100%;
}
.box-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.box-container ul {
list-style: none;
}
.box-container .box {
display: inline-block;
height: 100px;
width: 100px;
background: pink;
border-radius: 50%;
text-align: center;
position: relative;
cursor: pointer;
}
.box-container .box span {
transform-origin: 0% 0%;
position: absolute;
top: 50%;
left: 50%;
border-radius: 50%;
margin-top: -20px;
margin-left: -20px;
display: block;
width: 40px;
height: 40px;
background: #58C9B9;
color: #fff;
line-height: 40px;
text-align: center;
transform-origin: calc(100% - 20px) calc(100% - 20px);
opacity:0;
transform:rotate(0deg);
}
li:nth-child(1):hover > .animate1{
transition:.5s ease;
transform:rotateY(360deg);
}
li:nth-child(2):hover > .animate2{
transition:.5s ease;
transform:rotateY(360deg);
}
li:nth-child(3):hover > .animate3{
transition:.5s ease;
transform:rotateY(360deg);
}
.animate1{
animation: animate .5s ease-in-out, opty .5s ease-in-out forwards;
}
.animate2 {
animation: animate .5s ease-in-out .5s, opty .5s ease-in-out forwards .5s;
}
.animate3 {
animation: animate .5s ease-in-out 1.0s, opty .5s ease-in-out forwards 1s;
}
#keyframes animate {
0% {
opacity: 0;
transform: rotateY(0deg);
}
100% {
opacity: 1;
transform: rotateY(360deg);
}
}
#keyframes opty {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="main-content">
<div class="box-container">
<ul class="list-unstyle list-inline">
<li class="box "><span class="animate1">20%</span></li>
<li class="box "><span class="animate2">40%</span></li>
<li class="box "><span class="animate3">50%</span></li>
</ul>
</div>
</div>
<div>
I think the problem is with your animation property .I'm edited it and it's working fine.I'm added the snippet below.
body, html {
height: 100%;
}
.main-content {
position: relative;
height: 100%;
}
.box-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.box-container ul {
list-style: none;
}
.box-container .box {
display: inline-block;
height: 100px;
width: 100px;
background: pink;
border-radius: 50%;
text-align: center;
position: relative;
cursor: pointer;
}
.box-container .box span {
transform-origin: 0% 0%;
position: absolute;
top: 50%;
left: 50%;
border-radius: 50%;
margin-top: -20px;
margin-left: -20px;
display: block;
width: 40px;
height: 40px;
background: #58C9B9;
color: #fff;
line-height: 40px;
text-align: center;
transform-origin: calc(100% - 20px) calc(100% - 20px);
}
.box-container .box:hover span {
background: #4F86C6;
transform: rotateY(360deg);
transition: .5s;
}
.animate1 {
animation: animate .5s ease-in-out 1;
}
.animate2 {
animation: animate .5s ease-in-out .5s;
}
.animate3 {
animation: animate .5s ease-in-out 1s;
}
#keyframes animate {
0% {
opacity: 0;
transform: rotateY(0deg);
}
100% {
opacity: 1;
transform: rotateY(360deg);
}
}
<div class="main-content">
<div class="box-container">
<ul class="list-unstyle list-inline">
<li class="box "><span class="animate1">20%</span></li>
<li class="box "><span class="animate2">40%</span></li>
<li class="box "><span class="animate3">50%</span></li>
</ul>
</div>
</div>
<div>
I've created a Slanted Div, however I ran into problem I cannot solve, I've googled this but did not find any answers.
body {
background: black;
}
#slantedwrapper {
overflow: hidden;
margin-left: 50px;
}
#slanted {
display: inline-block;
/* margin-right:-4px; */
width: 400px;
margin-left: -45px;
/* background-image: url("http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg"); */
}
#slanted a {
position: relative;
background-color: #1d1d1d;
/* background-image: url("http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg"); */
box-sizing: border-box;
background-size: cover;
/* padding:1em; */
display: block;
transform: skewX(-30deg);
width: 100%;
min-height: 3.5em;
text-align: center;
border-right: 5px solid #20c397;
height: 150px;
/* line-height: 110px; */
overflow: hidden;
}
#slanted span {
color: white;
position: absolute;
box-sizing: border-box;
transform: skewX(30deg);
left: 0;
width: 100%;
/* height: 150px; */
/* background-image: url("http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg"); */
}
}
}
.current a {
background:#70cb00;
}
#slanted a img {
transform: skewX(30deg);
overflow: hidden;
margin-top: -20px;
padding-top: 0px;
width: 123%;
height: 123%;
margin-left: -50px;
opacity: 0.6;
-webkit-transition: opacity 0.3s linear 0s;
-o-transition: opacity 0.3s linear 0s;
transition: opacity 0.3s linear 0s;
}
#slanted img:hover {
opacity:1;
}
#caption {
background-color: #333333;
width: 100%;
height: 25px;
display: block;
position: absolute;
bottom: 0;
z-index: 99;
opacity: 0.7;
color: #D2D2D2;
-webkit-transition: background-color 0.3s linear 0s;
-o-transition: background-color 0.3s linear 0s;
transition: background-color 0.3s linear 0s;
}
/*Combination hover effects*/
#slanted:hover #caption {
background-color: #20c397;
opacity:1.0;
}
#slanted:hover img {
opacity:1.0;
}
/* END OFCombo hover effects*/
p.nonskew {
transform: skewX(30deg);
color: White;
margin: 0;
margin-left: 22%;
padding: 1.5%;
text-align: left;
font-size: 0.8em;
}
<div id="slantedwrapper">
<div id="slanted">
<a href="#">
<div id="caption">
<p class="nonskew">A Caption: Description</p>
</div>
<img src="http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg" alt="SLANTED DIV"></a>
</div>
<!--end of wrapper-->
</div>
JSFiddle version
here's the problem:
Hover over the div, it hovers fine, but at the bottom right corner, where nothing is there (where the overflow is hidden) still hovers if you place your mouse over the blank area where the angle begins, how do I solve this into when it hovers- it only applies to shape of the div only?
Thank you
You seem to have the right idea, using both the unskew and intuitive to using the skew, however, something like the below example may work for you:
html {
background: radial-gradient(#222, blue);
height: 100%;
}
div.wrap{
height: 150px;
width: 300px; position: relative;
overflow: hidden;
}
div.innerwrap {
height: 100%;
width: 100%;
transform: skewX(-30deg);
position: absolute;top:0;left:0;
overflow: hidden;
margin-left: -70px;
transition: all 0.4s;
border-right: 5px solid tomato;
cursor:pointer;
}
div.innerwrap:hover span {
background: gold;
}
div.innerwrap:before {
content: "";
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background: url(http://lorempixel.com/300/300);
transform: skewX(30deg);
transform-origin: top left;
}
div span {
position: absolute;
bottom: 0;
left: 0%;
width: 120%;
transform: skewX(30deg);
background: red;
text-align:center;
transition: all 0.4s;
}
<div class="wrap">
<div class="innerwrap">
<span>TITLE</span>
</div>
</div>
For further information, #Harry has created a wide variety of examples here in which you may find useful.