background-size:contain cuts off image edges in Firefox - html

Let's say that this is my HTML.
<div id="spirit_tutorial_reward">
<div id="spirit_tutorial_reward_icon" style="background:url({$MEDIA_IMAGE_DOWNLOAD_PATH}appimages/gift_icon_spirit.png) no-repeat;background-size: contain;"></div>
<div id="spirit_tutorial_reward_header">45 Spirit</div>
<div id="spirit_tutorial_reward_text">Use Spirit to recruit new Rusherz in the Locker Room!</div>
</div>
And this is my styling:
#spirit_tutorial_reward
{
position:absolute;
top:77px;
left:371px;
width:45%;
}
#spirit_tutorial_reward_icon
{
background:url(../images/gift_icon_spirit.png) top no-repeat;
width:60px;
height:60px;
position:absolute;
top:0px;
left:0px;
float:left;
}
#spirit_tutorial_reward_header
{
font-size: 15px;
font-family:"NFLEndzoneSansBold";
color: #000;
position:absolute;
left:69px;
top:0px;
float:left;
}
#spirit_tutorial_reward_text
{
font-size: 15px;
font-family:"NFLEndzoneSansBold";
color: #000;
position:absolute;
left:69px;
top:22px;
float:left;
}
On no-zoom or normal mode , the images appear to have chopped off on Firefox (see attached image) but when I zoom my page , the image appears to becoming better (see attached image). I am facing this issue only in Firefox. Can anyone here help me out.
EDIT : FIDDLE demo for the problem

This worked for me in one of my recent encounters. This prevented the image from being cut off:
transform: rotate(0.0001deg);

Try setting background-size to 59px which i did in that fiddle and worked as expected.
i.e
<div id="spirit_tutorial_reward_icon" style="background:url({$MEDIA_IMAGE_DOWNLOAD_PATH}appimages/gift_icon_spirit.png) no-repeat;background-size:59px;"></div>
If this answer was helpful.Dont forget to mark to apport or mark as answer
Thanks
AB

I think it's a subpixel problem. That's the reason the image works fine in some zoom modes.
I edited your jsFiddle to set the background-size to 99.9%, and then works properly. You can see the example here.
Note: I put the !important to overwrite the inline styles... feeling lazy, you know ;)

If you want the background image to cover whole page.. apply the image to background and give background size:cover to it..
you may try this:
body {
background-image: url(your-image.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-color: #EEE;
background-size: cover;
}
you may refer this http://www.css3.info/preview/background-size/

Related

The banner at the top of my webpage repeats

Ok, so my website, http://ichion.tk, I have a banner, it repeats. What I'm asking is how to fix this. Here is my code for it:
<html>
<head>
<style>
div#title {
background-image: url("banner.png");
color:yellow;
height:120px;
width:100%;
}
</style>
</head>
<body>
<div id=title>
</div>
If it makes a difference, it's the same in both Google Chrome and Safari. I don't know about how it looks in other browsers.
I assume that you don't want the banner to be stretched at all, so I would avoid using background-size. Instead, define a background-color of black:
background-repeat: no-repeat;
background-color: black;
Here is a screenshot of the result:
Check this out:
div#title {
background: #00ff00 url("banner.gif") no-repeat fixed center;
}
Read more here: http://www.w3schools.com/cssref/css3_pr_background.asp
Try using:
background-repeat:no-repeat;
background-size:cover;

Why background-image doesn't work in IE9?

This is the website:
http://loveloverun.com/test/love_run/
I checked and it works properly in chrome and firefox. The problem is that in IE9 the background image only works on the body level.
Here is my css:
body {
font-family : Open Sans;
min-height: 0px;
background: url("../img/front/bg.png") repeat;
height:auto;
}
And the other div e.g. container
.container {
width: 1022px !important; /*1302px*/
background-color:#ffffff;
background-clip:content-box;
}
and one more example (footer):
#enquiry {
color:#ffffff;
background: url("../img/front/black.png") repeat;
}
I checked the doc type and it's not missing any tag.
And also some other places are different from the chrome / firefox one, so I wonder:
1) Are there any plugin to enhance the compatibility? I tried modernizer, but it seems to have no effect.
2) How can background problem be solved for IE9?
Update:
body {
font-family : Open Sans;
min-height: 0px;
background-image: url("../img/front/bg.png");
background-repeat: repeat;
height:auto;
}
still the same result
Update 2:
Screen cap in ie9
Use
background-image: url(/image.whatever);
instead of the
background: url (); code

Nivo Slider Links do not Work in IE8

I've installed the newest version of Nivo Slider, 3.2, on my website and it works fine in Firefox and Chrome, but in IE8 the slide links do not work. I have searched and tried a bunch of solutions, such as adding to my CSS:
.nivoSlider a, .nivoSlider img {
display: block !important;
}
But that only works on the first image of the slider, the rest of the images do not link to their assigned pages.
My site is here, click "Truck Sales" up top
CSS is here
Thanks for any help!
This is a known issue with nivo slider, add the following css:
.nivoSlider a.nivo-imageLink{
display:none;
filter: alpha(opacity=0);
opacity: 0;
-webkit-opacity:0;
-moz-opacity:0;
-khtml-opacity:0;
opacity: 0;
background-color:#fff;
}
.nivoSlider a.nivo-imageLink img{
display:block!important;
}
It happens because IE has problem rendering an empty <a> without a background.. I've ran into this when a long time ago I wanted to place a link over a flash element. giving it a background and setting opacity to 0 will make it work correctly without harming the design.
This didn't work for me, but I found another solution:
.nivoSlider a.nivo-imageLink {
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
border:0;
padding:0;
margin:0;
z-index:6;
display:none;
background:white;
filter: alpha(opacity=0);
/other than IE/
-moz-opacity:0;
-khtml-opacity:0;
opacity: 0;
line-height: 375px; /*Change this to the height of your image*/
font-size: 0px;
}
.nivoSlider a.nivo-imageLink img{
display:block!important;
}
Now add some text in front of each image link:
TEXT GOES HERE<img src="yourimage.jpg" alt="image" />
It's a little hacky but it does the trick. -Cheers

ie-8 getting black outlines on images

i am developing a site and getting black outline in ie8
its looking great in all other major browser but not in ie-8
please help me this is my live link
http://www.cadellfoods.com.au/food-service-products.html
(the section in circular shape)
please help me
the code for all images is as following
#Section1
{
background:transparent url('Images/Chilled.png') no-repeat;
background-repeat:no-repeat;
border:none; outline:none; outline:0;
border-width: 0;
}
Seems OK in IE 8 too here. maybe you have issues in IE 8 on windows XP
as a good practice, you should not start your ID's or classes with capital letters.
Might not be it, but I have noticed IE puts borders on linked images. You need to undo those defaults.
#Section1 a:link img {
border:none;
}
Don't forget the :hover and :visited pseudos.
Just in case try these too
#Section1 img {
border:none;
}
#Section1 a:link {
border:none;
}

Background command not displaying/showing from the stylesheet when using date picker js

I'm new to this site having stumbled across it recently (and am loving it!) and was wondering whether someone can help me - I'm using Kelvin Luck's fantastic date picker and for some reason a background image is not behaving properly...
Here's the code straight from my CSS sheet:
a.dp-choose-date {
background: url (../calendar.png) no-repeat scroll 0 0 transparent;
display:block;
float:left;
height:16px;
margin:5px 3px 0;
overflow:hidden;
padding:0;
text-indent:-2000px;
width:16px;
}
however when the background image is viewed through firebug, firebug doesn't show the style for the background image at all:
a.dp-choose-date {
display:block;
float:left;
height:16px;
margin:5px 3px 0;
overflow:hidden;
padding:0;
text-indent:-2000px;
width:16px;
}
Would anyone have any ideas as to why this is happening? I've never seen this before!
The url by the way is http://www.s330042945.websitehome.co.uk/contact.php
Many thanks,
Andy
You need to remove the space between 'url' and the '('. This needs to be:
background: url(../calendar.png) no-repeat scroll 0 0 transparent;