Solved

Hover Effect Not Working Properly

Posted on 2014-10-13
8
221 Views
Last Modified: 2014-10-13
I have a rounded rectangle that is on a transparent background which is square.  I have added a hover effect to this image.  The problem is that when I hover over the image the glow effect is around the transparent (square) and not the rounded rectangle.  How can I fix this so that it is around the rounded rectangle and not the square?

The site
http://www.davidschure.com/index.html

The code
<!--ZOOOOOOM-->
#zoom_img img{
height:50px;
width:50px;
-moz-transition:-moz-transform 0.1s ease-in; 
-webkit-transition:-webkit-transform 0.1s ease-in; 
-o-transition:-o-transform 0.1s ease-in;
}

#zoom_img img:hover{
-moz-transform:scale(1.25); 
-webkit-transform:scale(1.25);
-o-transform:scale(1.25);
position:relative;
z-index:1000;
-moz-box-shadow: 0 0 25px #38b8fa;
-webkit-box-shadow: 0 0 25px #38b8fa;
box-shadow: 0px 0px 25px #38b8fa; 
}

Open in new window

0
Comment
Question by:DS928
  • 4
  • 4
8 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40377214
That is your image with the black edge and square corners, the transparency is irrrelevant as it doesn't change the image from being a square

Though why use an image when you could achieve the same thing with a few lines of css.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40377227
In case that doesn't make sense...
If I have a 100px x 100px transparent image and draw a red circle with a diameter of 50px then I don't have a circle as the image - I have a 100px image, so any css is applied to the whole image
Ergo use CSS to create your boxes or get rid of the borders around the image and use css to give the image rounded corners equal the border in the image.
0
 

Author Comment

by:DS928
ID: 40377256
Thank you Gary.  But how would I do this?  How would I add the text?  The Borders?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 58

Expert Comment

by:Gary
ID: 40377279
http://jsfiddle.net/v60x3x78/1/

Use this HTML
<div class="grid_4 box-1" id="zoom_img">
<!-- Nothing here except what you want to add to the box -->
</div>

Open in new window


And this CSS
#zoom_img{
    width:300px;
    height:200px;
    border:10px solid gray;
    border-radius:15px;
}

Open in new window

0
 

Author Comment

by:DS928
ID: 40377319
This is what I did,
	<div id="zoom_img" class="grid_4 box-1">
        	This is the text that I want to add to this box.  This is more text.
        </div>

Open in new window

and
<!--ZOOOOOOM-->
#zoom_img img{
height:200px;
width:300px;
background:#FFF;
border:10px solid gray;
border-radius:15px;
-moz-transition:-moz-transform 0.1s ease-in; 
-webkit-transition:-webkit-transform 0.1s ease-in; 
-o-transition:-o-transform 0.1s ease-in;
}

#zoom_img img:hover{
-moz-transform:scale(1.25); 
-webkit-transform:scale(1.25);
-o-transform:scale(1.25);
position:relative;
z-index:1000;
-moz-box-shadow: 0 0 25px #38b8fa;
-webkit-box-shadow: 0 0 25px #38b8fa;
box-shadow: 0px 0px 25px #38b8fa; 
}

Open in new window


I see the text,  But no white background or border.  And no zoom effect.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40377324
Remove img from these two classes - there is no image

#zoom_img img{         ----->    #zoom_img{ 

#zoom_img img:hover{         ----->    #zoom_img:hover{

Open in new window


And add to #zoom_img{}
background:#fff
0
 

Author Comment

by:DS928
ID: 40377333
I stand corrected.  I fixed the code to match yours.
0
 

Author Closing Comment

by:DS928
ID: 40377334
Great thank you Gary.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question