Here is a toughie.
JSfiddle
I have a link that opens up a video player(see below). The isotope hydrology image is the links image, and the play button image is within a span as a background image.
I am using a css sprite so that when someone hovers over any part of the image, the play image will change to what is below.
This works fine in all browsers except IE. In IE9, when I hover over the the isotope hydrology image it changes color and is clickable(like the image above). But when I hover over the actual play button, it switches from the blue "active" play button(above) to the grey "inactive" play button (top image) and it is not clickable.
I created the images below to illustrate what is happening:
This is when you hover over the isotope hydrology image (which is what i want to happen)
Once I hover over the play button (which is a span background image), this is what it looks like.(the cursor becomes a text cursor and the css sprite changes back to the non-hover color)
any help with this would be awesome.
Here is the html:
<div id="news-video" class="news-tab">
<div id="video-box-left">
<div class="video-img">
<span class="video-play-q-left">play</span><img src="resources-na/images/video-amano-scientific-forum.PNG" alt="Isotope Hydrology - The Fingerprints of Water" width="200" height="155" border="1">
</div>
<div class="video-text">
<p><strong>Food for the Future - Meeting Challenges with Nuclear Applications - Statement to 2012 Scientific Forum</strong></p>
</div>
</div>
<div id="video-box-right">
<div class="video-img">
<img src="resources-na/images/video-isotope-hydrology.jpg" alt="Isotope Hydrology - The Fingerprints of Water" width="200" height="155" border="1"><span class="video-play-q-right">play</span>
</div>
<div class="video-text">
<p><strong>Isotope Hydrology - The Fingerprints of Water</strong></p>
</div>
</div>
Here is the css:
#news-video {
color: #8A8A8A;
font-size: 1.1em;
line-height: 1.6667;
padding-left: 0px;
}
#video-box-left{
margin-left: 10px;
margin-right: 20px;
float: left;
width: 210px;
}
#video-box-right{
margin-right: 10px;
float: left;
width: 210px;
}
.video-img {
background-color: #EEEEEE;
border: 1px solid #DDDDDD;
margin-bottom: 5px;
padding: 4px;
width: 200px;
height: 155px;
}
.video-text {
}
.video-play-q-left {
background: url("../images/video-play-q-big.png") no-repeat scroll 0 0 transparent;
background-position: center top;
height: 50px;
position: absolute;
text-indent: -9999em;
width: 50px;
left: 100px;
top: 127px;
}
.video-play-q-right {
background: url("../images/video-play-q-big.png") no-repeat scroll 0 0 transparent;
background-position: center top;
height: 50px;
position: absolute;
text-indent: -9999em;
width: 50px;
left: 321px;
top: 127px;
}
a:hover .video-play-q-right{
background-position: center bottom;
}
a:hover .video-play-q-left{
background-position: center bottom;
}
My DOCTYPE tag was forcing IE to go into "IE9 Compatibility View".
I changed the tag and it was fine.
Thanks for the help everyone.
Related
I'm trying to add a png image, which has no background, to the website, but it still grabs the grey background colour and adds a weir extra "tail" to the image. Why this happens and how do I prevent it?
My code is this...
HTML
<body>
<center>
<div id="parte1" class="container">
<a href="https://tiendaclaro.pe"> <img src="icons/LogoClaro.png"
alt="Claro"
height="75"
>
</a>
</div>
</center>
CSS
*{
background-color: #eeeeee;
}
#parte1{
background-color: #da291c;
}
#logo{
margin-left: 100px;
margin-top: 15px;
margin-bottom: 0px;
And even adding a colour background to the .png still has that extra weird grey thing next to it
#logo{
margin-left: 100px;
margin-top: 15px;
margin-bottom: 10px;
background-color: #da291c;
}
#parte1 img {
background-color: transparent;
display: block;
}
footer {
width: 960px;
height: 100px;
background-color: #121212;
line-height: 100px;
color: white;
font-size: 10px;
position: relative;
}
#copyright {
margin-left: 3%;
opacity: 0.4;
}
#icon {
background-image: url('../img/icon.png');
background-repeat: no-repeat;
width: 85px;
height: 86px;
opacity: 0.050;
position: absolute;
right: 0;
margin-top: 7px;
margin-right: 5px;
display: block;
}
#top {
background-image: url('../img/backtop.png');
background-repeat: no-repeat;
width: 29px;
height: 29px;
margin-top: 4%;
margin-right: 6%;
float: right;
}
#top:hover {
background-image: url('../img/tophover.png');
background-repeat: no-repeat;
width: 29px;
height: 29px;
}
<footer>
<div id="top"></div>
<span id="copyright" class="left_content">GGLex is copyrighted © 2014, All rights reserved.</span>
<div id="icon"></div>
</footer>
What it looks like:
(source: gyazo.com)
I am trying to add a faded out icon, on the right side on my footer. I did it, works just fine, but when I tried to add back to top button with hover, it failed.
Basically, when I hover, it won't work, but if I remove the div "icon", it will work easily (the hover).
Why does it happen & how can I make it work?
Unfortunately this happens sometimes when css styles overlaps. You can use javascript to solve this...
onmouseover="window.location='URL HERE'"
Example
<div onmouseover="window.location='URL HERE'"></div>
Hope this helps and please comment back if this doesn't work or you need more help
the below works...
<footer>
<div id="top"></div>
<span id="copyright" class="left_content">GGLex is copyrighted © 2014, All rights reserved.</span>
<div id="icon" onmouseover="window.location='URL HERE'"></div>
</footer>
URL TO top of page. ID any element at top of page for example id="top" then replace URL with www.YOUR_WEB_NAME.CO.UK/#top
You can try to add pointer-events: none; to the absolutely positioned element. That way clicks/"pointer events" can go "through it", affecting the element behind it.
Explanation
Im trying to make a few buttons.
I have a background image on a div, parts of this images are transparent. The background image is a circle.
When the user hovers over that div it changes the background to purple showing through the transparent parts.
The div is 80px x 80px. Same with the background image.
The radius of the div is 100px;
Problem
When the user hovers over the div, there is a small part of the purple showing outside the background image.
How do I stop this from happening?
HTML Code
<div id='Menu'>
<div onclick="gotoPage('HomePage')" class='MenuItem' id='home'>
Home
</div>
<div onclick="gotoPage('AboutUsPage')" class='MenuItem' id='team'>
About Us
</div>
</div>
CSS Code
#Menu
{
width: 80px;
}
.MenuItem
{
font-family: 'Share Tech', bold, sans-serif;
background-image: url(../images/button.png);
color: rgb(51, 0, 102);
text-align: center;
vertical-align: center;
margin-top: 25px;
border-radius: 999px;
width: 80px;
height: 80px;
line-height: 80px;
}
.MenuItem:hover
{
background-color: rgba(51, 0, 102, 1);
color: darkgray;
cursor: pointer;
/**position: relative;
top: -5px;
left: -5px;
margin-bottom: -20px;**/
}
Example Page
The overlapping image for your button isn't the full 80 x 80;
I changed background position in the fiddle to compensate but now the hover color bleeds to the bottom.
You need to fix the image itself or change the overall size of the button which is what is demonstrated on the fiddle http://jsfiddle.net/69Jaw/ and the code below.
border-radius: 78px;
background-position: -2px -1px;
width: 77px;
height: 78px;
line-height: 78px;
Assuming every thing is as you say, I would only suggest that you add this to ensure the bg image is sized and located correctly:
background-position:center;
background-size:80px 80px;
Also, the border-radius should be amended to:
border-radius: 50%;
JSFiddle Demo
I am having problems with the following link:
the play image is a <span> element with a background image used with a css sprite.
When i hover over the isotope hydrology image like in the image above everything works fine (link and css sprite). The problem is in IE9, when the cursor hovers over the css sprite(play button) the sprite goes back to the non-hover look and you cannot click to the link from inside (see image below).
If anyone knows why this is happening that would be awesome. Here's a jsfiddle I made for it, but it doesn't recreate the problem.
I have the following html and css:
html:
<div id="video-box-left">
<div class="video-img">
<a href="#" onclick="window.open('http://wwwindex.html','photoessay','scrollbars=no,resizable=yes,width=850,height=722')">
<span class="video-play-q-left">play</span>
<img src="resources-na/images/forum.PNG" width="200" height="155" border="1"></a>
</div>
<div class="video-text">
<p><strong>Food for the Future</strong></p>
</div>
</div>
css:
#video-box-left{
margin-left: 10px;
margin-right: 20px;
float: left;
width: 210px;
}
.video-img {
background-color: #EEEEEE;
border: 1px solid #DDDDDD;
margin-bottom: 5px;
padding: 4px;
width: 200px;
height: 155px;
}
.video-text {
}
.video-play-q-left {
background: url("../images/video-play-q-big.png") no-repeat scroll 0 0 transparent;
background-position: center top;
height: 50px;
position: absolute;
text-indent: -9999em;
width: 50px;
left: 100px;
top: 127px;
}
a:hover .video-play-q-left{
background-position: center bottom;
}
I'd guess this is due to an issue with the DOCTYPE of your document which causes IE9 to render the document in quirks mode. That would explain why the JSFiddle doesn't reproduce the problem. Try opening the Developer Console in IE9 and make sure Document Mode and Browser mode are both set to IE9. If that solves your problem, make sure your DOCTYPE tag is set to HTML 5, e.g.
<!DOCTYPE html>
I have a div that when you mouseover has a child div appear to display information. The basic code is as follows:
HTML
<div id="container">
<div id="hidden_div">
<iframe></iframe>
</div>
</div>
CSS
#container {
position: absolute;
height: 20px;
width: 40px;
top: 8px;
left: 30px;
}
#hidden_div {
position: absolute;
background: url(../_images/inside_btn_back.png) repeat;
height: 60px;
width: 350px;
top: 0px;
left: 0px;
margin-top: 20px;
z-index: 50;
display: none;
border: 1px solid #a08f89;
}
#container:hover #hidden_div, #container.over #hidden_div, #container:focus #hidden_div {
display: block;
}
This works in all browsers except IE(specifically IE9). I have a navigation window using the same method for a drop down menu that works fine in IE. don't know why its not working with the div. Here is a link to the live page here. The mouse over div is the facebook like button near the bottom of the page.
it's the page loaded in the iframe not having a transparent background which causes the hover to fail in IE.