Images Won't Flip - html

Trying to create similar effect like this: http://callmenick.com/tutorial-demos/image-caption-reveal-on-hover/index-2.html
However i am stuck with my codes and it won't just flip perfectly.
here's my CSS:
/* Paragraphs and Heading 2 styling, change according to your needs */
.slide p, .slide h2 {
color:#ffffff;
padding:10px;
left: -20px;
top: 20px;
position: relative;
}
.slide p {
font-family:'Lato';
font-size:12px;
line-height:18px;
margin: 0;
}
.slide h2 {
font-size:20px;
line-height:24px;
margin: 0;
font-family:'Lato';
}
/* 1. Sliding Up */
.moveup img {
position: absolute;
left: 0;
top: -15px;
width: 100%;
/*Fit the image to its container. the aspect ratio is preserved; the image will not be distorted*/
cursor: pointer;
-webkit-transition: transform 2s ease-in-out;
-moz-transition: top .5s ease-in-out;
-o-transition: top 2s ease-in-out;
transition: transform .5s ease-in-out;
}
.slide:hover img{
-webkit-transform:rotateY(90deg);
backface-visibility:hidden;
/*set to a value to hide the whole image*/
padding-bottom:200px;
}
.slide:hover .a{
-webkit-transform:rotateY(360deg);
/*set to a value to hide the whole image*/
padding-bottom:200px;
}
.a{
transition:.5s ease-in;
}
Any idea which part I made wrong?
Here's the JSFIDDLE: http://jsfiddle.net/r26bz3xn/2/
Thanks for the help in advance!

If you're going to use that example, why not just use their structure? I will say that tutorial seemed to have left out quite a lot of styles that made this thing work. I wish I could explain better as to what you were doing wrong but I've added a working fiddle to the bottom and the code below:
HTML
<figure>
<img src="http://beautyblenderdupe.com/wp-content/uploads/2015/01/01.jpg" alt=""/>
<figcaption>
<h2>This is a cool title!</h2>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nost.</span>
</figcaption>
</figure>
CSS
.slide figure {
margin: 0;
position: relative;
}
.slide figure img {
display: block;
position: relative;
z-index: 10;
max-width: 100%;
height: auto;
}
.slide figure figcaption {
display: block;
position: absolute;
z-index: 5;
padding: 20px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.slide figure h2 {
font-family:'Lato';
color: #fff;
font-size: 22px;
line-height: 1.2;
font-weight: 700;
margin-bottom: 10px;
}
.slide figure span {
display: block;
font-family:'Lato';
font-size:12px;
line-height:18px;
margin: 0;
color: #FFF;
}
.slide figure figcaption {
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(26, 76, 110, 0.5);
text-align: center;
backface-visibility: hidden;
transform: rotateY(-180deg);
transition: all 0.5s;
}
.slide figure figcaption h3 {
margin-top: 150px
}
.slide figure img {
backface-visibility: hidden;
transition: all 0.5s;
}
.slide figure:hover img,
#effect-2 figure.hover img {
transform: rotateY(180deg);
}
.slide figure:hover figcaption,
#effect-2 figure.hover figcaption {
transform: rotateY(0);
}`enter code here`
FIDDLE

Related

Why is the transition timing working on color, but not text-align?

I am trying to add transition timing when switching the text alignment via :hover. The transition is added to the color properly, but not the text alignment.
example: Codepen
div {
background-color: #ff4000;
height: 300px;
width: 600px;
}
div:hover>h1 {
color: #ddd;
text-align: right;
transition: .6s ease-in !important;
}
<div>
<h1>Lorem Ipsum</h1>
</div>
I guess it was just the CSS Working Group decided not to implement it for whatever reasons. But there are other ways around, see the following demo by using position and transform tricks.
div {
background-color: #ff4000;
height: 300px;
width: 600px;
position: relative;
}
h1 {
position: absolute;
left: 0;
top: 0;
white-space: nowrap;
margin: 0;
transition: 0.6s ease-in;
}
div:hover > h1 {
color: #ddd;
left: 100%;
transform: translateX(-100%);
}
<div>
<h1>Lorem Ipsum</h1>
</div>
Another approach is to animate width.
div {
background-color: #ff4000;
height: 300px;
width: 600px;
}
h1 {
width: 0;
text-align: right;
white-space: nowrap;
margin: 0;
transition: 0.6s ease-in;
}
div:hover > h1 {
color: #ddd;
width: 100%;
}
<div>
<h1>Lorem Ipsum</h1>
</div>
transform: translateX()
text-align is not animatable but position and transforms are -- the latter being the better choice because it's less GPU/CPU intensive than the former. The following is a what was added as the first leg of the animation in the demo.
transform:translateX(300px);
transition: transform .6s ease-in;
Demo
div {
background-color: #ff4000;
height: 300px;
width: 600px;
}
h1 {
transform: translateX(0px);
transition: transform .6s ease-out;
}
div:hover>h1 {
color: #ddd;
width: 200px;
transform: translateX(300px);
transition: transform .6s ease-in;
}
<div>
<h1>Lorem Ipsum</h1>
</div>

Css image animation malfunction

.demo-3 {
margin-top: 25px;
position: relative;
width: 300px;
height: 200px;
overflow: hidden;
float: left;
margin-right: 20px
}
.demo-3 figure {
margin: 0;
padding: 0;
position: relative;
cursor: pointer;
margin-left: -250px
}
.demo-3 figure img {
display: block;
position: relative;
z-index: 10;
margin: -150px 0;
}
.demo-3 figure figcaption {
display: block;
position: absolute;
z-index: 5;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}
.demo-3 figure h2 {
font-family: 'Lato';
color: #fff;
font-size: 20px;
text-align: left
}
.demo-3 figure p {
display: block;
font-family: 'Lato';
font-size: 12px;
line-height: 18px;
margin: 0;
color: #fff;
text-align: left;
}
.demo-3 figure figcaption {
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 29px 44px;
background-color: rgba(26, 76, 110, 0.5);
text-align: center;
backface-visibility: hidden;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
transform: rotateY(-180deg);
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s
}
.demo-3 figure img {
backface-visibility: hidden;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s
}
.demo-3 figure:hover img,
figure.hover img {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg)
}
.demo-3 figure:hover figcaption,
figure.hover figcaption {
-webkit-transform: rotateY(0);
-moz-transform: rotateY(0);
transform: rotateY(0)
}
<figure>
<img src="D:\\ps\Notepad++\preview.jpg" alt="" />
<figcaption>
<h2>This is a cool title!</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nost.</p>
</figcaption>
</figure>
</li>
</ul>
I saw this image animation on the internet and thought it was perfect for my idea. The problem was that the image was not positioned correctly in the box so i did some changes in the css code. Now that the image is aligned properly the text which was supposed to be on the back side of the picture got vanished because of the changes i did in the margin property. This is the url of the image if you need to see the original image (http://creativenerds.co.uk/wp-content/uploads/2015/08/wet-ink.jpg). Any help will be highly appreciated. Thanks :)

css3 transition effect on a block

I've built a block section on my website, what I'd like to do is when the user hovers over the block, the block-caption fades in over the top.
Currently there's no effect, it just jumps.
See this fiddle for current code
How do I do this?
Code:
.blocks {
overflow: hidden;
padding-top: 0;
padding-bottom: 0;
}
.blocks [class*=col] {
padding: 1px;
}
.blocks .block {
background: #979797;
display: block;
margin: 0 auto;
overflow: hidden;
position: relative;
height: 350px;
}
.blocks .block h3 {
color: #ffffff;
font-size: 2.5em;
text-align: center;
margin-top: 8px;
}
.blocks .block .block-title {
position: absolute;
text-align: center;
top: 40%;
width: 100%;
display: block;
}
.blocks .block img {
opacity: .4;
display: block;
height: 350px;
margin: 0 auto;
width: 100%;
}
.blocks .block .block-caption {
background: #394074;
top: 0;
width: 100%;
height: 100%;
color: #ffffff;
display: block;
left: 0;
opacity: 0;
padding: 20px 0;
position: absolute;
text-align: center;
}
.blocks .block .block-caption a {
display: inline-block;
border: 2px solid #ffffff;
padding: 20px 30px;
font-weight: bold;
text-transform: uppercase;
color: #ffffff;
font-size: 1.2em;
margin-top: 1em;
}
.blocks .block .block-caption a:hover {
text-decoration: none;
}
.blocks .block .block-caption p {
margin-top: 1em;
margin-bottom: 1em;
display: block;
font-size: 1.4em;
color: #ffffff;
}
.blocks .block:hover .block-caption {
opacity: 1;
}
.blocks .block:hover img {
opacity: 0.2;
}
<div class="blocks">
<div class="block">
<div class="block-title">
<h3>Online GP <br> Service</h3>
</div>
<!-- /.block-title -->
<img alt="Training" src="https://placeholdit.imgix.net/~text?txtsize=75&txt=640%C3%97480&w=640&h=480">
<div class="block-caption">
<h3>Online GP <br> Service</h3>
<p>Sed ut perspiciatis unde omnis iste natus
<br>voluptatem accusantium doloremque</p>
Find Out More
</div>
<!-- /.block-caption -->
</div>
</div>
Here's a working fiddle with what (I think it is) you want:
https://jsfiddle.net/utrgtech/2/
You can add:
-webkit-transition: opacity ease-out 1s;
-moz-transition: opacity ease-out 1s;
-o-transition: opacity ease-out 1s;
transition: opacity ease-out 1s;
For example. It enables compatibility throughout all browsers.
Here's documentation: https://css-tricks.com/almanac/properties/t/transition/
Just give
.block-caption {
transition:2s all;
-webkit-transition:2s all;
-ms-transition:2s all;
}
Working Fiddle
Please use transition: all linear .3s; on .blocks .block .block-caption I have use fade effect for this caption. Check this fiddle https://jsfiddle.net/utrgtech/3/
you to ad to your .block this
.blocks .block .block-caption{
transition: all 1s ease-in-out;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out; // mozilla brower
-o-transition: all 1s ease-in-out; // opera brower
}
put animation: fadeIn .6s ease-in 1 forwards; in .blocks .block:hover .block-caption
.blocks .block:hover .block-caption {
opacity: 0;
animation: fadeIn .6s ease-in 1 forwards;
}
#keyframes fadeIn {
to {opacity: 1}
}

Div height 100% of content

I have an easy question for CSS guru that is ruining my weekend.
Basically I have a div with an image on the left and some text on the right.
I need that the box height is the same of the content text so for example in the image below the last line is outside the box while I need that the box is height like the content.
I cannot use fixed height due to the text can change inside the box, I need only a min-height already defined.
Some guru can help me?
<a href="#" class="myClass">
<div class="postImageUrl" style="overflow:hidden; z-index: 10; max-width: 100%;">
<div class="imgUrl" style="background-image:url(http://cdn8.openculture.com/wp-content/uploads/2015/03/17231820/Lorem-Ipsum.jpg);">
</div>
</div>
<div class="centered-text-area clearfix">
<div class="centered-text">
<div class="myClass-content">
<div class="ctaText" style="float:left;">
UpNeXt
</div>
<div style="clear:both;"></div>
<div class="postTitle" style="float:left;">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat
</div>
</div>
</div>
</div>
</a>
And this is the <style>
.myClass
, .myClass .postImageUrl
, .myClass .imgUrl
, .myClass .centered-text-area {
min-height: 100px;
position: relative;
}
.myClass
, .myClass:hover
, .myClass:visited
, .myClass:active {
border:0!important;
}
.myClass {
display: block;
transition: background-color 250ms;
webkit-transition: background-color 250ms;
width: 100%;
opacity: 1;
transition: opacity 250ms;
webkit-transition: opacity 250ms;
background-color: #eaeaea;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
-o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
}
.myClass:active
, .myClass:hover {
opacity: 1;
transition: opacity 250ms;
webkit-transition: opacity 250ms;
background-color: #FFFFFF;
}
.myClass .postImageUrl
, .myClass .imgUrl {
background-position: center;
background-size: cover;
float: left;
margin: 0;
padding: 0;
}
.myClass .postImageUrl {
width: 30%;
}
.myClass .imgUrl {
width: 100%;
}
.myClass .centered-text-area {
float: right;
width: 70%;
}
.myClass .centered-text {
display: table;
min-height: 100px;
left: 0;
position: absolute;
top: 0;
}
.myClass .myClass-content {
display: table-cell;
margin: 0;
padding: 0 74px 0 18px;
position: relative;
vertical-align: middle;
width: 100%;
}
.myClass .ctaText {
border-bottom: 0 solid #fff;
color: #34495E;
font-size: 13px;
font-weight: bold;
letter-spacing: .125em;
margin: 0;
padding: 0;
text-decoration: underline;
}
.myClass .postTitle {
color: #000000;
font-size: 18px;
font-weight: 600;
margin: 0;
padding: 0;
}
.myClass .ctaButton {
background-color: #FFFFFF;
margin-left: 10px;
position: absolute;
right: 0;
top: 0;
}
.myClass:hover .imgUrl {
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-o-transform: scale(1.2);
-ms-transform: scale(1.2);
transform: scale(1.2);
}
.myClass .imgUrl {
-webkit-transition: -webkit-transform 0.4s ease-in-out;
-moz-transition: -moz-transform 0.4s ease-in-out;
-o-transition: -o-transform 0.4s ease-in-out;
-ms-transition: -ms-transform 0.4s ease-in-out;
transition: transform 0.4s ease-in-out;
}
You can find the problem here http://jsfiddle.net/L26s1vc5/
This is what I see now
While this is what I expect to have:
The min-height is 100px.
I already tested with height:100%, overflow-y:auto, height:auto without success :(
Thanks for your help, Alex.
You have two issues causing your problem. You have a clearing issue and an absolute positioning issue. Inside of .myClass you have two floated divs. That alone would cause the issue you are having. You've even attempted to fix it in two places. You added a class of clearfix in one place (which would only work if you had a css rule to match). You also have an empty div with an inline styling of clear: both;, though for that to work you would need to have it as the third div in your link.
Still, even if either of the above were working properly the issue wouldn't have been fixed. This is because of your absolute positioning on .centered-text. When you absolutely position something you take it out of the flow of your document. This means that it's parent has no idea the size of what's inside of it. All of your sizing was coming from your liberal use of min-height: 100px. If you remove the absolute positioning on .centered-text and use the clearfix properly then your code works just fine.
.myClass,
.myClass .postImageUrl,
.myClass .imgUrl,
.myClass .centered-text-area {
min-height: 100px;
position: relative;
}
.myClass,
.myClass:hover,
.myClass:visited,
.myClass:active {
border: 0!important;
}
.myClass {
display: block;
transition: background-color 250ms;
webkit-transition: background-color 250ms;
width: 100%;
opacity: 1;
transition: opacity 250ms;
webkit-transition: opacity 250ms;
background-color: #eaeaea;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
-o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17);
}
.myClass:active,
.myClass:hover {
opacity: 1;
transition: opacity 250ms;
webkit-transition: opacity 250ms;
background-color: #FFFFFF;
}
.myClass .postImageUrl,
.myClass .imgUrl {
background-position: center;
background-size: cover;
float: left;
margin: 0;
padding: 0;
}
.myClass .postImageUrl {
width: 30%;
}
.myClass .imgUrl {
width: 100%;
}
.myClass .centered-text-area {
float: right;
width: 70%;
}
.myClass .centered-text {
display: table;
min-height: 100px;
/* Removed absolute positioning*/
}
.myClass .myClass-content {
display: table-cell;
margin: 0;
padding: 0 74px 0 18px;
position: relative;
vertical-align: middle;
width: 100%;
}
.myClass .ctaText {
border-bottom: 0 solid #fff;
color: #34495E;
font-size: 13px;
font-weight: bold;
letter-spacing: .125em;
margin: 0;
padding: 0;
text-decoration: underline;
}
.myClass .postTitle {
color: #000000;
font-size: 18px;
font-weight: 600;
margin: 0;
padding: 0;
}
.myClass .ctaButton {
background-color: #FFFFFF;
margin-left: 10px;
position: absolute;
right: 0;
top: 0;
}
.myClass:hover .imgUrl {
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-o-transform: scale(1.2);
-ms-transform: scale(1.2);
transform: scale(1.2);
}
.myClass .imgUrl {
-webkit-transition: -webkit-transform 0.4s ease-in-out;
-moz-transition: -moz-transform 0.4s ease-in-out;
-o-transition: -o-transform 0.4s ease-in-out;
-ms-transition: -ms-transform 0.4s ease-in-out;
transition: transform 0.4s ease-in-out;
}
/* Added clearfix class here so that it can work properly*/
.clearfix:after {
content: "";
display: block;
clear: both;
}
<a href="#" class="myClass clearfix"><<!-- moved clearfix here so it can take effect for the necessary area -->>
<div class="postImageUrl" style="overflow:hidden; z-index: 10; max-width: 100%;">
<div class="imgUrl" style="background-image:url(http://cdn8.openculture.com/wp-content/uploads/2015/03/17231820/Lorem-Ipsum.jpg);">
</div>
</div>
<div class="centered-text-area">
<div class="centered-text">
<div class="myClass-content">
<div class="ctaText" style="float:left;">
UpNeXt
</div>
<div class="postTitle" style="float:left;">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet
dolore magna aliquam erat volutpat
</div>
</div>
</div>
</div>
</a>
All I did remove said absolute positioning (it wasn't doing anything that I could tell), moved your clearfix to the proper place, removed your extra div (also a clearfix attempt) and added a clearfix class to the end of your css.
It looks like you've tried to do a lot of things to make this code work. You may want to go through and see what's doing what, a lot of it looks like it's not doing anything at all.
https://jsfiddle.net/dixalex/ojoevj1k/
The fiddle has the solution done via jQuery using the .height() call and JavaScript using the setInterval call. Every 50 milliseconds, the function will check to see if the image height is the same height as the container with the text. If they are not equal in pixel height, CSS is applied directly to make them equal.
Since this is dynamic, I did not have to change any of your CSS.
var makeSameHeight = setInterval( function() {
var currentTextHeight = $('div.myClass-content').height() + "px";
var imgDivHeight = $('div.imgUrl').height() + "px";
if (currentTextHeight === imgDivHeight)
{
var doNothing = "";
} else {
$('div.imgUrl, div.postImageUrl, a.myClass').css("height", currentTextHeight);
}
}, 50);
Only add overflow:hidden;
.myClass .myClass-content {
display: table-cell;
margin: 0;
padding: 0 74px 0 18px;
position: relative;
vertical-align: middle;
width: 100%;
overflow:hidden;
}
If isn't set height:XXpx; the container will fit to the content.

Hover state still active after mouse leaves div

I am experiencing a weird issue where the hover state is still being hovered after the mouse leaves the div. To see this hover over the picture. I tried inspecting but I can't figure it out.
Youtube video https://youtu.be/PX8psGOTbNM
Not working on Wordpress: http://sogomarketingagency.com/test-3/
Works fine on CodePen: http://codepen.io/CookieFresh89/pen/emLXEK
I have tried deactivating all plugins and reverting back to original theme and am still getting this problem.
The Code:
.modal {
display: block;
text-align: center;
width: 185px;
margin: 0 auto;
}
.modal-about > label {
background: #07B288;
border-radius: .3em;
color: #ffffff;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-left: 0px;
padding: 0.50em 1.0em;
-webkit-transition: all 0.55s;
transition: all 0.55s;
}
.modal-about input {
position: absolute;
left: -50px;
top: 130px;
z-index: -10;
}
#media (min-width: 43.75em) {
.modal-about input {
right: 50px;
}
}
.modal__overlay {
background: rgba(255, 255, 255, 0.9);
bottom: 0;
left: 0;
position: fixed;
right: 0;
text-align: center;
top: 0;
z-index: -800;
}
.modal__box {
padding: 1em .75em;
position: relative;
margin: 1em auto;
max-width: 500px;
width: 90%;
}
#media (min-height: 37.5em) {
.modal__box {
left: 50%;
position: absolute;
top: 50%;
-webkit-transform: translate(-50%, -80%);
-ms-transform: translate(-50%, -80%);
transform: translate(-50%, -80%);
}
}
#media (min-width: 50em) {
.modal__box {
padding: 1.75em;
}
}
.modal__box label {
background: #07B288;
border-radius: 50%;
color: white;
cursor: pointer;
display: inline-block;
height: 1.5em;
line-height: 1.5em;
position: absolute;
font-size: 30px;
right: .5em;
top: .5em;
width: 1.5em;
}
.modal__box h1 {
font-size: 50px;
margin-bottom:0px;
}
.modal__box h2 {
color: #07B288;
margin-bottom: 15px;
margin-top: 10px;
text-transform: uppercase;
}
.modal__box hr {
border: 0;
height: 1px;
background: #E8E8E8;
}
.modal__box p {
text-align: left;
}
.modal__overlay {
opacity: 0;
overflow: hidden;
-webkit-transform: scale(0.5);
-ms-transform: scale(0.5);
transform: scale(0.5);
-webkit-transition: all 0.75s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 0.75s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
input:checked ~ .modal__overlay {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-webkit-transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
z-index: 800;
}
input:focus + label {
-webkit-transform: scale(0.97);
-ms-transform: scale(0.97);
transform: scale(0.97);
}
.about-name-h1 {
margin-top: 10px;
}
.about-wrapper {
width: 185px;
height: 227px;
position: relative;
}
.about-overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: 40px 0px;
background: rgba(255, 255, 255, 0.75);
visibility: hidden;
opacity: 0;
text-align: center;
text-transform:uppercase;
}
.about-overlay:hover {
padding: 70px 0px;
}
.about-wrapper:hover .about-overlay {
visibility: visible;
opacity: 1;
}
.about-name, .about-overlay {
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-ms-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
transition: all 0.4s ease;
}
.about-name {
padding: 15px 0px;
text-align: center;
border: 1px solid #e8e8e8;
border-top: 0;
font-size: 16px;
background: #ffffff;
margin:0px;
width: 183px;
cursor:pointer;
}
.about-name:hover {
background: #07B288;
color: #fff;
}
.avatar-frame {
border: 2px solid #07B288;
}
.avatar-frame, .avatar-frame img {
width: 120px;
height: 120px;
-webkit-border-radius: 60px;
margin: 0 auto;
/* Saf3+, Chrome */
border-radius: 60px;
/* Opera 10.5, IE 9 */
/*-moz-border-radius: 30px; Disabled for FF1+ */
}
<div class="about-wrapper">
<img src="http://sogomarketingagency.com/wp-content/uploads/garry-about-president.jpg" alt="polaroid" />
<div class="about-overlay">
<h3>Founder</h3>
<div class="modal-about">
<input id="modal-about" type="checkbox" name="modal-about" tabindex="1">
<label for="modal-about">View Profile</label>
<div class="modal__overlay">
<div class="modal__box">
<label for="modal-about">✖</label>
<div class="avatar-frame">
<img src="http://sogomarketingagency.com/wp-content/uploads/garry-about-me-president-circle.jpg" alt="">
</div>
<h1 class="about-name-h1">Garry Howell</h1>
<h2>Founder</h2>
<hr>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac laoreet elit. Phasellus dignissim purus vitae urna cursus, quis congue ligula tristique. Ut nec blandit risus. Donec at orci ut justo venenatis viverra. Suspendisse in volutpat lacus. In enim est, dapibus eget ipsum sed, suscipit ultrices diam.</p>
</div>
</div>
</div>
</div>
</div>
<h4 class="about-name">Garry Howel</h4>
It seems that div.modal__overlay expands div.about-wrapper which creates a wider area to trigger :hover.
Edit: As mentioned by CBroe, descendants trigger the hover states of their ancestors. Since div.modal__overlay is position:fixed, it effectively creates a second hover area for but outside of div.about-wrapper.
I had success by adding visibility to the toggle for div.modal__overlay:
.modal__overlay {
opacity:0;
visibility:hidden;
...
}
input:checked ~ .modal__overlay {
opacity: 1;
visibility:visible;
...
}
However, I'm not sure why this helps, because elements hidden by visibility:hidden are still supposed to affect layout (i.e. take up space). So, if it creates a bigger :hover area with opacity:0, shouldn't it do the same with visibility:hidden? Maybe someone can help clarify this behavior.
Edit: More insight from Cbroe in the comments, below.
I built a demonstration of the difference, below. Try hovering over the blue area for box #1. Then try hovering over the same area on box #2, which is visibility:hidden.
div.container {
position:relative;
width: 200px;
height: 50px;
border: 1px solid #CCC;
margin: 0 0 1em 0;
}
div.prop {
margin-left: 200px;
width: 200px;
height: 50px;
background-color: #0CC;
}
div.prop.invisible {
visibility: hidden;
}
div.container:hover {
background-color: #F00;
}
div.container p {
position:absolute;
top:0;
left:0;
}
<div class="container">
<p>BOX #1</p>
<div class="prop"></div>
</div>
<div class="container">
<p>BOX #2</p>
<div class="prop invisible"></div>
</div>
And here is my working version of your code:
.modal {
display: block;
text-align: center;
width: 185px;
margin: 0 auto;
}
.modal-about > label {
background: #07B288;
border-radius: .3em;
color: #ffffff;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-left: 0px;
padding: 0.50em 1.0em;
-webkit-transition: all 0.55s;
transition: all 0.55s;
}
.modal-about input {
position: absolute;
left: -50px;
top: 130px;
z-index: -10;
}
#media (min-width: 43.75em) {
.modal-about input {
right: 50px;
}
}
.modal__overlay {
background: rgba(255, 255, 255, 0.9);
bottom: 0;
left: 0;
position: fixed;
right: 0;
text-align: center;
top: 0;
z-index: -800;
}
.modal__box {
padding: 1em .75em;
position: relative;
margin: 1em auto;
max-width: 500px;
width: 90%;
}
#media (min-height: 37.5em) {
.modal__box {
left: 50%;
position: absolute;
top: 50%;
-webkit-transform: translate(-50%, -80%);
-ms-transform: translate(-50%, -80%);
transform: translate(-50%, -80%);
}
}
#media (min-width: 50em) {
.modal__box {
padding: 1.75em;
}
}
.modal__box label {
background: #07B288;
border-radius: 50%;
color: white;
cursor: pointer;
display: inline-block;
height: 1.5em;
line-height: 1.5em;
position: absolute;
font-size: 30px;
right: .5em;
top: .5em;
width: 1.5em;
}
.modal__box h1 {
font-size: 50px;
margin-bottom:0px;
}
.modal__box h2 {
color: #07B288;
margin-bottom: 15px;
margin-top: 10px;
text-transform: uppercase;
}
.modal__box hr {
border: 0;
height: 1px;
background: #E8E8E8;
}
.modal__box p {
text-align: left;
}
.modal__overlay {
opacity:0;
visibility:hidden;
overflow: hidden;
-webkit-transform: scale(0.5);
-ms-transform: scale(0.5);
transform: scale(0.5);
-webkit-transition: all 0.75s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 0.75s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
input:checked ~ .modal__overlay {
opacity: 1;
visibility:visible;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-webkit-transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
z-index: 800;
}
input:focus + label {
-webkit-transform: scale(0.97);
-ms-transform: scale(0.97);
transform: scale(0.97);
}
.about-name-h1 {
margin-top: 10px;
}
.about-wrapper {
width: 185px;
height: 227px;
position: relative;
}
.about-overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: 40px 0px;
background: rgba(255, 255, 255, 0.75);
visibility: hidden;
opacity: 0;
text-align: center;
text-transform:uppercase;
}
.about-overlay:hover {
padding: 70px 0px;
}
.about-wrapper:hover .about-overlay {
visibility: visible;
opacity: 1;
}
.about-name, .about-overlay {
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-ms-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
transition: all 0.4s ease;
}
.about-name {
padding: 15px 0px;
text-align: center;
border: 1px solid #e8e8e8;
border-top: 0;
font-size: 16px;
background: #ffffff;
margin:0px;
width: 183px;
cursor:pointer;
}
.about-name:hover {
background: #07B288;
color: #fff;
}
.avatar-frame {
border: 2px solid #07B288;
}
.avatar-frame, .avatar-frame img {
width: 120px;
height: 120px;
-webkit-border-radius: 60px;
margin: 0 auto;
/* Saf3+, Chrome */
border-radius: 60px;
/* Opera 10.5, IE 9 */
/*-moz-border-radius: 30px; Disabled for FF1+ */
}
<div class="about-wrapper">
<img src="http://sogomarketingagency.com/wp-content/uploads/garry-about-president.jpg" alt="polaroid" />
<div class="about-overlay">
<h3>Founder</h3>
<div class="modal-about">
<input id="modal-about" type="checkbox" name="modal-about" tabindex="1">
<label for="modal-about">View Profile</label>
<div class="modal__overlay">
<div class="modal__box">
<label for="modal-about">✖</label>
<div class="avatar-frame">
<img src="http://sogomarketingagency.com/wp-content/uploads/garry-about-me-president-circle.jpg" alt="">
</div>
<h1 class="about-name-h1">Garry Howell</h1>
<h2>Founder</h2>
<hr>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac laoreet elit. Phasellus dignissim purus vitae urna cursus, quis congue ligula tristique. Ut nec blandit risus. Donec at orci ut justo venenatis viverra. Suspendisse in volutpat lacus. In enim est, dapibus eget ipsum sed, suscipit ultrices diam.</p>
</div>
</div>
</div>
</div>
</div>
<h4 class="about-name">Garry Howel</h4>