background-position not displaying correctly on mobile phones - html

.icon {
background: #F0F0F0 url('../images/assets/user.png') no-repeat center left 10px;
background-size: 24px 24px;
-webkit-background-size: 24px 24px;
}
The above CSS works fine in all of the major browsers, but when I view it on any mobile device (HTC, Sony Ericson, Samsung, iPhone etc) the background CSS does not display, not even the color of the background. However, when I remove the 10px in the background-position style - it all works.
I have tried replacing 10px with em and % but it doesn't help the case. Any thoughts or suggestions?

The background property can only take a horizontal and vertical position—in your case center andd 10px—but you have specified three position values. This is why it works when you remove the third value.

Related

Expand background photo entire width of card

I can't seem to eliminate the white space of the background photo. Below is all of the .css styling i've tried:
.prflBg {
ion-card-content{
background-image: url('../assets/img/headerBg.png');
background-size: 320px 158px;
background-repeat: no-repeat;
width: 100% !important;
overflow: visible !important;
margin-left: -10px !important;
padding-top: 5px !important;
padding-left: 0 !important;
padding-right: 0 !important;
}[![enter image description here][1]][1]
The "background-size" property is what determines how large your image will be. It's hard to know where things are going wrong without knowing the size of your background image, or the container you are trying to put it in.
However the background-size property is pretty standard to work with. The first number determines the width of the image, the second determines the height. There are also "word" choices you can use that do various things.
In your case I would recommend using "background-size:cover" as this is what the cover value does according to w3Schools:
Cover will resize the background image to cover the entire container,
even if it has to stretch the image or cut a little bit off one of the
edges

Safari displays black border around video

I'm trying to "embed" a video in an image (in this case a video in a laptop graphic). I've set the image as bg and with padding I place the video in the "screen" area. Since this must be responsive, percentage-based paddings are in use.
.media > video {
background-image: url(...);
background-size: contain;
background-repeat: no-repeat;
background-position: center top;
padding: 5% 15% 12%;
max-width: 100%;
}
http://codepen.io/jerivas/pen/jqoVYj?editors=1100
It all works great... except in Safari. For some reason the video has a black border (sometimes all around, other times it's left/right or bottom/top). The video needs to blend seamlessly with the laptop, and this breaks the effect.
I have already trying recalculating padding, width, and height values with JS to only use integer px units, but the problem persists (this part is not in the pen).

background sizing in css bindings?

Can someone please explain to me what is going on with this property. Its a css background img the scales down to half size for retina pixel display density.
background: url('../img/kellin-retina.png') no-repeat scroll 0px 0px /200px 70px;
What is up with the 0px 0px part before the /200px 70px. If i take it out the background doesn't scale down. what are these two pixel sizes binding to?
Thanks
The first set 0px 0px defines the position of the background image (top left), the second set 200px 70px defines the dimensions, in this short-hand notation it represents background-size.
If you only have one value in the second set, it will be the width of the image. To just set the height, you can do something like:
background: url('../img/kellin-retina.png') no-repeat scroll 0px 0px /auto 70px;
The background will then be 70px high and the width will be scaled accordingly. See a demo, where the background image will always be half as high as the viewport.
To be sure of what you're stating, consider including all the properties like this:
background-image: url('../img/kellin-retina.png');
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 0px 0px;
background-size: 200px 70px;
This is your code broken down to what it means. I don't exactly what your problem is, but try opening your browser's Dev Tools to uncheck and check the properties to see what effect it has on your page, and modify the numbers to better understand what you're doing. If you need help in making something specific work, I can help if you make a Fiddle of your code or show me the live site.

background image displaying incorrectly when browser is narrow

On this page I have 2 background images:
(1) A blue sunburst that is set as a background image of <html>
html {
background: url("BEhmxDlyFwihBhnuPwHL8VU1fr59VGeXflJlinXMr5q.svg") no-repeat fixed center center / 100% auto transparent;
outline: 0 none !important;
}
(2) An image showing a crowd of arms in the air that appears at the bottom of every page. I use the sticky footer solution to make this stick to the bottom of each page
Everything works fine at normal browser widths, but once the browser width is below about 500px a white space starts appearing at the top:
and at the bottom
of every page. Previously I used
background-size: cover;
for the sunburst image, but this caused the website to crash the browser on iOS 6 (seriously), so I need to find a way to fix this without using this rule.
The white space is due to the browser positioning the image center center as defined in the CSS.
html {
background: url(BEhmxDlyFwihBhnuPwHL8VU1fr59VGeXflJlinXMr5q.svg) no-repeat center center fixed;
background-size: 100%;
outline: 0!important;
}
I thought the solution would be just setting background-size: 100% 100% as the current setting of just background-size: 100%; is 100% width and auto height. But it's bugged in Chrome - background-size:100% 100%; doesn't work properly in Chrome. There is a workaround answer on that question that might help.
However, if the background-size: 100%; is dropped for width < 500px, perhaps in one of your #media rules, then the background fills the page as expected. The rule is still required when the window is greater than the width of the image to stretch the image.
If you're not opposed to a JS solution, you could try using Backstretch.
Set the background-size to something larger than 100%. I think 200-250% will cover that area.
background-size:220%;
One side effect this has is the fact that it causes slight lag due to the size.
Here, Have this solution...
In this file...
http://festivals.ie/static/C5z61WeZeCfyTRbmu6lNPsxXxwhibmxExq6ADwtSPjh.css
On line no 793,
this code is there in the last part of that line...
html{background:url(BEhmxDlyFwihBhnuPwHL8VU1fr59VGeXflJlinXMr5q.svg) no-repeat center center fixed;
background-size:100%;
outline:0!important;}
Add this property : background-position: 0px 0px;
Making the code:
html{background:url(BEhmxDlyFwihBhnuPwHL8VU1fr59VGeXflJlinXMr5q.svg) no-repeat center center fixed;
background-size:100%;
outline:0!important;
background-position: 0px 0px;}
And fyi, as andyb pointed out the white space is the image leaving its top position to be centered, thereby making it look like a white space starting to appear..
Hope you get the point.
Regards

Getting rid of undesired layout element on webpage

What's this?
And how do I get rid of it? Actual webpage here.
Remove min-width: 640px from your .singleinfo css class
The min-width for the singleinfo class is set to 640px while the backgroundimage is only 630px wide. You can set no-repeat on the background or change the min-width to 630px.
It's the background of div.singleinfo repeating. To get rid of it, add no-repeat to the background property, so it becomes:
background: #F7F7F7 url(images/macmet.jpg) bottom left no-repeat;
Apart from defaulting to a repeating background, you've also set the background colour inconsistent with the remainder of the page.
.singleinfo { background: #F4F4F4 url(images/macmet.jpg) bottom left no-repeat; }
Appears correctly in Chrome 11 on Windows.
Change your style.css to get this:
.singleinfo {
background: url("images/macmet.jpg") no-repeat scroll left bottom #F4F4F4;
font: 12px Georgia,Arial,century gothic,verdana,sans-serif;
margin: 0;
max-height: 20px;
min-width: 640px;
padding: 5px 0 15px;
}
This fix was tested and works OK on:
Mozilla Firefox 4.0.1
Internet Explorer 9.0.8112.16421
Opera 11.10.2092
Google Chrome 11.0.696.60
change the background property of your class .singleinfo to >
background: url("images/macmet.jpg") no-repeat scroll left bottom #F7F7F7