Solved

Hover Effect Not Working Properly

Posted on 2014-10-13
8
211 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you Gary.  But how would I do this?  How would I add the text?  The Borders?
0
 
LVL 58

Expert Comment

by:Gary
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:DS928
Comment Utility
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
Comment Utility
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
Comment Utility
I stand corrected.  I fixed the code to match yours.
0
 

Author Closing Comment

by:DS928
Comment Utility
Great thank you Gary.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now