Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Simonson
1,738 PointsHow do I prevent CSS Hover transitions on images from showing up when I load my page?
I have a nice hover effect on the images on my website, SimoMarketing.com. Unfortunately the hover text appears immediately when the page loads for a split second before it dissapears. I only want it to appear when it is hovered over. How can I prevent that from happening? Thanks!
2 Answers
Dave McFarland
Treehouse TeacherYou might try setting the initial opacity of the <p>
tags inside the status divs to 0, and adding the transition property to that element like this:
.status p {
opacity: 0;
-webkit-transition: opacity 1s ease-in;
-moz-transition: opacity 1s ease-in;
-o-transition: opacity 1s ease-in;
transition: opacity 1s ease-in;
}
Then, add a :hover pseudo-class like this:
.status:hover p {
opacity: 1;
}
Notice that the :hover is applied to the containing element (.status) but the rule applies to the <p>
inside that element. In other words, this rule says "when you hover over the status element make the opacity of any paragraphs inside that element 1." You'll also need to remove the opacity from the .status rule and the .status:hover rule.
Also, the <title>
of your page is "Lynda.com | Creating a Responsive Web Design". You might want to change that.
Michael Simonson
1,738 PointsThanks. I did what you advised. The problem still exists in Chrome. I'm not sure if it was happening in IE and Mozilla before, but it's solved in those browsers. What do you think the issue with Chrome might be?