Solved

Hover Effect Not Working Properly

Posted on 2014-10-13
8
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

631 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