Text over top of image scrolling left and right - html

I am trying to create a rollover effect image with CSS. The image starts with just a title overlaid, then when hovered over a text overlay appears. I am happy with how it is going so far, except the text area that comes over the top the text runs off to the right. Also you can scroll up and down, but i am assuming this is the same problem?
https://jsfiddle.net/p27sf4e1/3/
HTML
<div class="service-box">
<p class="box-title">Social Media</p>
<div class="service-overbox">
<h2 class="title">Social Media</h2>
<p class="tagline">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac sodales lorem. Donec condimentum feugiat feugiat. Vestibulum blandit dolor risus, eget fringilla sem suscipit vel. In id ex ut nulla mollis suscipit nec in velit. Fusce auctor dapibus elit. Nam in justo sapien.</p>
</div>
</div>
CSS
.service-box .overtext {
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.service-box .title {
text-align: center;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
}
.service-box:hover .title,
.service-box:focus .title {
opacity: 1;
transform: translateY(0px);
-webkit-transform: translateY(0px);
}
.service-box .tagline {
text-align: center;
opacity: 0;
transition-delay: 0.2s;
transition-duration: 0.2s;
}
.service-box:hover .tagline,
.service-box:focus .tagline {
opacity: 1;
transform: translateX(0px);
-webkit-transform: translateX(0px);
}
.service-overbox {
background-color: #000000;
position: relative;
color: #fff;
z-index: 2;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
width: 100%;
height: 100%;
padding: 30px;
}
.service-box:hover .service-overbox { opacity: 0.7; }
.service-box:hover .box-title { opacity: 0; }
.service-box {
cursor: pointer;
position: relative;
overflow: auto;
height: 380px;
width: 100%;
max-width: 580px!important;
background-image: url(http://www.voicecommunications.co.uk/voice-website-new/wp-content/uploads/2016/07/voice-social-media.jpg);
background-size: cover;
background-repeat: no-repeat;
}
.box-title {
position: absolute;
top: 40%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
color: #ffffff;
font-size: 38px;
line-height: 38px;
font-family: 'Anton', sans-serif;
color: #00AAC4;
}
.tagline {
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
line-height: 28px;
}
.title {
font-size: 40px!important;
font-family: 'Anton', sans-serif;
font-weight: 600;
margin-bottom: 10px;
}
Appreciate any comments that may help to solve.
Thanks

If you're not supporting IE7 and lower, try adding a box-sizing: border-box; property to your .service-overbox rule. It looks like it's the legacy box-model's handling of padding that is tripping you up.
.service-box .overtext {
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.service-box .title {
text-align: center;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
}
.service-box:hover .title,
.service-box:focus .title {
opacity: 1;
transform: translateY(0px);
-webkit-transform: translateY(0px);
}
.service-box .tagline {
text-align: center;
opacity: 0;
transition-delay: 0.2s;
transition-duration: 0.2s;
}
.service-box:hover .tagline,
.service-box:focus .tagline {
opacity: 1;
transform: translateX(0px);
-webkit-transform: translateX(0px);
}
.service-overbox {
background-color: #000000;
position: relative;
color: #fff;
z-index: 2;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
width: 100%;
height: 100%;
padding: 30px;
box-sizing: border-box;
}
.service-box:hover .service-overbox {
opacity: 0.7;
}
.service-box:hover .box-title {
opacity: 0;
}
.service-box {
cursor: pointer;
position: relative;
overflow: auto;
height: 380px;
width: 100%;
max-width: 580px!important;
background-image: url(http://www.voicecommunications.co.uk/voice-website-new/wp-content/uploads/2016/07/voice-social-media.jpg);
background-size: cover;
background-repeat: no-repeat;
}
.box-title {
position: absolute;
top: 40%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
color: #ffffff;
font-size: 38px;
line-height: 38px;
font-family: 'Anton', sans-serif;
color: blue;
}
.tagline {
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
line-height: 28px;
}
.title {
font-size: 40px!important;
font-family: 'Anton', sans-serif;
font-weight: 600;
margin-bottom: 10px;
}
<div class="service-box">
<p class="box-title">Social Media</p>
<div class="service-overbox">
<h2 class="title">Social Media</h2>
<p class="tagline">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac sodales lorem. Donec condimentum feugiat feugiat. Vestibulum blandit dolor risus, eget fringilla sem suscipit vel. In id ex ut nulla mollis suscipit nec in velit. Fusce auctor dapibus
elit. Nam in justo sapien.</p>
</div>
</div>

Related

Images in grid overlapping when resizing the screen

I have added some code to my website built using a Divi builder, in purpose add animated image caption hover effect, on grid of images - four in row.
Everything look great, except when I resize screen: then images starts to overlap.
I have made a lot of research and played with a code but i cant solve this issue. Please help me to find what part of CSS code stands for this overlapping?
Page URL is: http://sylwia.studiopowisle.pl/bb/
.box {
height: 250px;
position: relative;
overflow: hidden;
width: 250px;
margin-left: auto;
margin-right: auto;
}
.box img {
position: absolute;
left: 0;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box .overbox {
background-color: rgba(163, 0, 0, 0.8);
position: absolute;
top: 0;
left: 0;
color: #fff;
z-index: 100;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
width: 250px;
height: 250px;
padding: 130px 20px;
}
.box:hover .overbox {
opacity: 1;
}
.box .overtext {
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.box .title {
font-size: 2.5em;
text-transform: uppercase;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
}
.box:hover .title,
.box:focus .title {
opacity: 1;
transform: translateY(0px);
-webkit-transform: translateY(0px);
}
.box .tagline {
font-size: 0.8em;
opacity: 0;
transition-delay: 0.2s;
transition-duration: 0.2s;
text-align: center;
}
.box:hover .tagline,
.box:focus .tagline {
opacity: 1;
transform: translateX(0px);
-webkit-transform: translateX(0px);
}
.mendo-links {
text-transform: lowercase;
font-size: 36px;
position: relative;
color: white;
text-shadow: 3px 0 29px rgba(0, 0, 0, 0.28);
text-align: center;
vertical-align: middle;
margin-top: 26%;
}
.mendo-links-purpose {
font-size: 40px;
position: absolute;
top: 40%;
left: 21%;
color: white;
text-shadow: 3px 0 29px rgba(0, 0, 0, 0.28);
}
.mendo-links-passion {
font-size: 40px;
position: absolute;
top: 40%;
left: 23%;
color: white;
text-shadow: 3px 0 29px rgba(0, 0, 0, 0.28);
}
.mendo-lines {
position: absolute;
width: 37%;
top: 33%;
left: 32% !important;
}
.box:hover h4 {
display: none;
-webkit-transition: all 400ms ease-out;
-moz-transition: all 400ms ease-out;
-o-transition: all 400ms ease-out;
-ms-transition: all 400ms ease-out;
transition: all 400ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.box:hover .mendo-lines {
display: none;
-webkit-transition: all 400ms ease-out;
-moz-transition: all 400ms ease-out;
-o-transition: all 400ms ease-out;
-ms-transition: all 400ms ease-out;
transition: all 400ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.mendo-links-outline {
position: absolute;
width: 91%;
top: 5%;
left: 4.5% !important;
}
.mendo-links-title {
text-transform: lowercase;
font-size: 25px;
text-align: center;
margin-top: -100px !important;
}
.mendo-links-title:first-letter {
text-transform: uppercase;
}
.mendo-links-description {
text-align: center;
font-size: 12px;
margin-left: 20px;
margin-right: 20px;
margin-top: 22px;
line-height: 18px;
margin-bottom: 10px;
}
.mendo-links-read-more {
color: white;
font-size: 13px;
font-weight: bold;
}
<a href="/core-values">
<div class="box">
<p>
<img src="http://sylwia.studiopowisle.pl/wp-
content/uploads/2017/04/Untitled-3.jpg" alt="" />
</p>
<div class="overbox">
<p>
<img class="mendo-links-outline" src="http://sylwia.studiopowisle.pl/wp-
content/uploads/2017/04/outline-2.png" alt="" />
</p>
<div class="title overtext">
<p class="mendo-links-title">Web Design</p>
</div>
<div class="tagline overtext">
<p class="mendo-links-description">Synth jean shorts try-hard art party meh disrupt, forage offal ugh readymade cronut man braid. Readymade chartreuse pinterest sartorial, sustainable hoodie art party.
</p>
<p class="mendo-links-read-more">+ learn more</p>
</div>
</div>
</div>
</a>
Thank you ver much for your help and time,
Best greetings,
Sylwia
The problem is that you manually set the width of .box and .overbox to 250px;
There grid is responsive and should resize the images as you resize the window, giving them fixed width makes them too big and that's why they overlap.
Try giving .box and .overbox width:auto; and notice what happens.

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>

Dropdown menu hidden outside header element

I've been trying to add a dropdown menu to the header nav in a website, but the dropdown will simply not be visible outside the header element.
Here's a jsFiddle showing the problem. I've tried setting overflow to visible, but that hasn't worked so far. I'd really appreciate if someone could point me in the right direction
Code:
header {
background-color: white;
width: 100%;
overflow: visible;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transition: all 0.5s ease;
}
header:after {
content: "";
display: table;
clear: both;
}
header .oc {
height: 105px;
position: relative;
display: inline-block;
width: 100%;
}
.oc {
max-width: 1300px;
margin-left: auto;
margin-right: auto;
padding: 0 10px;
}
.oc:after {
content: "";
display: table;
clear: both;
}
header .nav-logo {
display: block;
left: 10px;
height: 54px;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
header .nav-logo {
display: block;
left: 10px;
height: 54px;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
header .main-nav {
right: 10px;
position: absolute;
top: 40%;
-webkit-transform: translateY(-40%);
-moz-transform: translateY(-40%);
-ms-transform: translateY(-40%);
-o-transform: translateY(-40%);
transform: translateY(-40%);
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-perspective: 1000;
-webkit-transform: scale3d(1, 1, 1);
}
header .main-nav ul {
margin: 0;
padding: 0;
list-style: none;
position: relative;
display: inline-table;
}
header .main-nav ul li {
display: inline-block;
}
header .main-nav-item {
color: #666668;
font-weight: 200;
font-size: 21px;
margin-left: 25px;
padding: 0 0 4px 0;
position: relative;
outline: none;
transition: all 0.3s ease 0s;
}
header .main-nav-item:after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 2px;
background: #89a959;
content: "";
opacity: 0;
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
-moz-transition: opacity 0.3s, -moz-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: translateY(10px);
-moz-transform: translateY(10px);
transform: translateY(10px);
}
header .main-nav ul ul {
display: none;
background: #fff;
border-top: 2px solid #73973f;
padding: 0;
position: absolute;
top: 150%;
z-index: 10000;
transition: all 0.3s ease 0s;
}
header .main-nav ul ul li {
display: block;
position: relative;
padding: 15px;
transition: all 0.3s ease 0s;
}
header .main-nav ul ul li a {
color: #666;
}
header .main-nav ul ul li:hover {
background: #eee;
}
header .main-nav ul li:hover > ul {
display: block;
}
.pitch {
background-color: #f6faf0;
padding: 40px 0;
position: relative;
text-align: center;
-webkit-transition: height 1.5s ease-in-out, padding 0.5s ease-in-out;
-moz-transition: height 1.5s ease-in-out, padding 0.5s ease-in-out;
transition: height 1.5s ease-in-out, padding 0.5s ease-in-out;
}
.pitch:after {
content: "";
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
bottom: -25px;
z-index: 2;
height: 0;
width: 0;
border-left: 25px solid transparent;
border-right: 25px solid transparent;
border-top: 25px solid #f6faee;
}
<header>
<div class="oc">
<a href="/" class="nav-logo">
<img src="http://placehold.it/300x50"
</a>
<nav class="main-nav">
<ul>
<li>About</li>
<li>Plans</li>
<li>
Contact
<ul>
<li>Request a Demo</li>
<li>Talk To Us</li>
</ul>
</li>
<li>Request a Demo</li>
<li>API</li>
<li>Login</li>
</ul>
</nav>
</div>
</header>
<div class="pitch">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut nec condimentum elit. Cras eget fringilla velit, id pulvinar libero. Sed venenatis, orci eu aliquet lacinia, orci eros pharetra erat, ac bibendum ex purus rhoncus erat. Sed pharetra in orci sed sollicitudin. Aliquam fringilla mollis arcu, aliquam euismod urna commodo nec. Nunc ut lorem augue. Phasellus quis nibh pretium, ultricies mauris et, tincidunt nisi. Suspendisse fermentum, libero eu pulvinar semper, massa ante tincidunt nisi, sed aliquet elit justo a purus.</p>
</div>
It is just a z-index issue. Your header dropdown menu is being "hidden" behind the .pitch content. So I updated your JSFiddle.
Just add position:relative;z-index:2; to .header and position: relative;z-index:1; to .pitch. Then your dropdown will overlay .pitch.

Font style changes when hovering in navigation (only in Chrome)

The title isn't the best, but I didn't really know how to describe it better.
Problem is, when I hover over my #navigation div it looks like the font-style of my #content div changes. But it only does this on Chrome.
When I view it in Opera or FireFox, it acts normal.
Anyone an idea how to solve this?
P.s.: The Ubuntu font is loaded via Google Fonts.
HTML
<body>
<div id="wrapper">
<div id="navigation">
<ul class="ca-menu">
<li>
<a href="#">
<span class="ca-icon">F</span>
<div class="ca-content">
<h2 class="ca-main">Home</h2>
<h3 class="ca-sub">Startpagina</h3>
</div>
</a>
</li>
<li>
<a href="#">
<span class="ca-icon">H</span>
<div class="ca-content">
<h2 class="ca-main">Portfolio</h2>
<h3 class="ca-sub">Websites en drukwerk</h3>
</div>
</a>
</li>
<li>
<a href="#">
<span class="ca-icon">N</span>
<div class="ca-content">
<h2 class="ca-main">Over Ons</h2>
<h3 class="ca-sub">Doel en motto</h3>
</div>
</a>
</li>
<li>
<a href="#">
<span class="ca-icon">K</span>
<div class="ca-content">
<h2 class="ca-main">Contact</h2>
<h3 class="ca-sub">Adresgegevens</h3>
</div>
</a>
</li>
</ul>
</div>
<div id="content">
<h1>Home - Portfolio - Over Ons - Contact</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque sed ligula vitae erat sollicitudin gravida.
Fusce adipiscing fringilla nibh ut feugiat.
In hac habitasse platea dictumst.
Donec ut nisi in dolor luctus eleifend.
Vivamus eleifend suscipit ipsum vitae posuere.
Morbi vestibulum erat eu nulla aliquet sagittis quis tempor lorem.
Sed orci nunc, dapibus eu cursus sit amet, fringilla a sapien.
Nullam non massa nunc.
</p>
</div>
</div>
CSS
body {
background: url('../images/noise.png') rgba(51, 51, 51, 1);
width: 100%;
height: 100%;
overflow-y: scroll;
}
#content h1, h2, h3 {
font-family: Ubuntu, sans-serif;
}
#content h1 {
color: rgba(0, 135, 255, 1);
font-size: 32px;
font-weight: bold;
margin: 4px;
border-left: 50px solid rgba(0, 135, 255, 1);
line-height: 36px;
}
#content h2 {
color: rgba(77, 184, 255, 1);
font-size: 24px;
font-weight: bold;
margin: 4px;
border-left: 50px solid rgba(77, 184, 255, 1);
line-height: 28px;
}
#content h3 {
color: rgba(130, 205, 255, 1);
font-size: 18px;
font-weight: bold;
margin: 4px;
border-left: 50px solid rgba(130, 205, 255, 1);
line-height: 22px;
}
#content p {
color: rgba(0, 0, 0, 1);
font-size: 16px;
margin: 4px;
font-family: Ubuntu, sans-serif;
line-height: 20px;
}
#content a {
color: rgba(0, 0, 0, 1);
text-decoration: none;
border-bottom: 1px dashed rgba(0, 0, 0, 1);
transition: all 300ms ease;
-webkit-transition: all 300ms ease;
-moz-transition: all 300ms ease;
-o-transition: all 300ms ease;
}
#content a:hover {
border-bottom: 1px dashed rgba(130, 205, 255, 1);
color: rgba(130, 205, 255, 1);
}
#wrapper {
margin: 10px auto;
padding: 0;
width: 940px;
height: 100%;
}
#navigation {
position: relative;
width: 220px;
height: 415px;
margin: 0 10px 0 0;
float: left;
}
#font-face {
font-family: 'WebSymbolsRegular';
src: url('websymbols.woff');
font-weight: normal;
font-style: normal;
}
.ca-menu{
padding: 0;
margin: 0 auto;
width: 220px;
}
.ca-menu li{
width: 220px;
height: 100px;
overflow: hidden;
position: relative;
display: block;
background: rgba(255, 255, 255, 1);
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
margin-bottom: 5px;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
}
.ca-menu li:last-child{
margin-bottom: 0px;
}
.ca-menu li a{
text-align: left;
width: 100%;
height: 100%;
display: block;
position: relative;
}
.ca-icon{
color: rgba(0, 0, 0, 1);
font-family: 'WebSymbolsRegular', cursive;
font-size: 24px;
text-shadow: 0px 0px 1px rgba(51, 51, 51, 1);
line-height: 100px;
position: absolute;
width: 70px;
left: 0px;
text-align: center;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
}
.ca-content{
position: absolute;
left: 65px;
width: 370px;
height: 60px;
top: 32px;
}
.ca-main{
font-size: 24px;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
font-family: Ubuntu, sans-serif;
color: rgba(77, 184, 255, 1);
}
.ca-sub{
font-size: 14px;
color: rgba(102, 102, 102, 1);
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
font-family: Ubuntu, sans-serif;
}
.ca-menu li:hover{
background: rgba(130, 205, 255, 1);
}
.ca-menu li:hover .ca-icon{
font-size: 36px;
color: rgba(130, 205, 255, 1);
opacity: 0.8;
text-shadow: -1px -1px 5px rgba(255, 255, 255, 1), 1px 1px 5px rgba(255, 255, 255, 1);
}
.ca-menu li:hover .ca-main{
opacity: 1;
color: rgba(51, 51, 51, 1);
-webkit-animation: moveFromTop 300ms ease-in-out;
-moz-animation: moveFromTop 300ms ease-in-out;
-ms-animation: moveFromTop 300ms ease-in-out;
}
.ca-menu li:hover .ca-sub{
opacity: 1;
-webkit-animation: moveFromBottom 300ms ease-in-out;
-moz-animation: moveFromBottom 300ms ease-in-out;
-ms-animation: moveFromBottom 300ms ease-in-out;
}
#-webkit-keyframes moveFromBottom {
from {
opacity: 0;
-webkit-transform: translateY(200%);
}
to {
opacity: 1;
-webkit-transform: translateY(0%);
}
}
#-moz-keyframes moveFromBottom {
from {
opacity: 0;
-moz-transform: translateY(200%);
}
to {
opacity: 1;
-moz-transform: translateY(0%);
}
}
#-ms-keyframes moveFromBottom {
from {
opacity: 0;
-ms-transform: translateY(200%);
}
to {
opacity: 1;
-ms-transform: translateY(0%);
}
}
#-webkit-keyframes moveFromTop {
from {
opacity: 0;
-webkit-transform: translateY(-200%);
}
to {
opacity: 1;
-webkit-transform: translateY(0%);
}
}
#-moz-keyframes moveFromTop {
from {
opacity: 0;
-moz-transform: translateY(-200%);
}
to {
opacity: 1;
-moz-transform: translateY(0%);
}
}
#-ms-keyframes moveFromTop {
from {
opacity: 0;
-ms-transform: translateY(-200%);
}
to {
opacity: 1;
-ms-transform: translateY(0%);
}
}
#content {
position: relative;
width: 700px;
margin: 0 0 0 10px;
padding: 0;
float: right;
}