Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hover Effect Not Working Properly

Posted on 2014-10-13
8
Medium Priority
?
230 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

916 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