background-image

can you create space between background image repeats?

与世无争的帅哥 提交于 2019-12-01 03:32:40
Is it possible to repeat a background image, but specify a number of pixels before the next repeat starts. i.e. background: url(img.png) [after 40px] repeat-x; I don't want to add empty space to the image. background-repeat: space; background-repeat: round; // round(520 / 100) = round(5.2) = 5 The browser will render five images in the space but adjust the image width to 104px (520px / 5). The image is made wider to fit the container. Full details here or read Background Size property 来源: https://stackoverflow.com/questions/15199863/can-you-create-space-between-background-image-repeats

Fill SVG element with with a background-image with an offset

℡╲_俬逩灬. 提交于 2019-12-01 03:14:56
问题 I want to do something similar to this Fill SVG path element with a background-image However, I want to shift/offset the image. With CSS, it can easily done by setting background-image and background-position . How do I do it with SVG? 回答1: You can use patternTransform on the pattern element to transform the pattern; it works just like the transform attribute you may already be familiar with. See the documentation for details. 回答2: You can use a pattern and a SVG element with the fill

How to make background image shrink proportionally to fit button size in javascript?

你离开我真会死。 提交于 2019-12-01 02:43:10
I am making a chessboard in javascript. The chessboard's squares (buttons) were originally designed to be 60px by 60px, but now they are 40px by 40px. button { width:40px; height:40px; border: 0 } However, some of the pieces that were designed for this earlier chessboard are still 60px by 60px. Is there any way in Javascript to make the images shrink proportionally to fit the square size? Currently, the images fit the square size, but do not shrink, so when I say, square.style.backgroundImage = imgLink; // square is the button, imgLink is "WhiteKing.jpg" for example. I get pieces like this -

CSS Background Images not loading

和自甴很熟 提交于 2019-12-01 00:43:50
I've got a very strange bug in chrome recently that is when you load the page first time, or in incognito mode that none of the background images show. when you then F5 the page, the background images all load in. When you inspect the css it shows the image url in the css panel, however when you mouse over the url it doesn't display a tool tip with a preview of the image. Neither when you check the downloaded resources are there even any mention of the background-images downloading. you then refresh the page and it works fine, tool-tip of the css url even shows a preview. The bug only randomly

CSS: Scale background image down if larger than window, keep at 100% otherwise

耗尽温柔 提交于 2019-12-01 00:25:47
问题 I'd like to deploy a background image in the body of my website that scales down with the window resolution, but does not scale up beyond it's original size (1920x1080). That way, users with smaller resolutions can still see the entire image, but those beyond do not have an ugly upscaled background. It doesn't look like background images support properties like max-width, which I would usually use for a purpose like that. What could the solution be? Is this possible in CSS without extra

CSS background image centered with Stellar JS

旧城冷巷雨未停 提交于 2019-11-30 22:16:39
I'm setting a background image to an element with Stellar JS and trying to achieve a centered image that moves in parallax. However when I try to use the standard approach I realize that the background-position is updated by stellar which then overrides the centering (I'm assuming that's what's overriding it). I've created a fiddle to explain the situation. http://jsfiddle.net/captDaylight/wvuQm/1/ Is there any way to have the image remain centered on scroll? (stack is making me to accompany this post with code, although it's insignificant in this case, the example on the fiddle is pretty

Progressive JPG background image trouble in Firefox

不问归期 提交于 2019-11-30 20:31:24
Quick question on progressive JPG backgrounds, if anyone knows. It appears that Firefox ignores the "progressiveness" of JPEGs if they are set as CSS backgrounds and waits until the image is fully loaded until displaying. I have Chrome and IE loading the background images progressively but Firefox just pops them in at full quality. I'm seeing the proof in front of me , but finding little to no info on it online. Just unanswered forum questions here and there. Anyone know anything about this? Is it a bug Mozilla know about or what is going on? Edit: Test case provided by easwee http://sample

CSS background image rendering differently on iPhone

廉价感情. 提交于 2019-11-30 19:17:22
We have a page design that works great in every PC browser that I have tried, but goes strange when viewed with an iPhone or iPod Touch. The problem is something to do with a centred background image thats very tall: #content_container { background-image:url('content-background.jpg'); background-position:top center; background-repeat:no-repeat; width:1020px; height:auto; } The content-background.jpg image is very tall (3000 pixels) and is designed to be 'revealed' as the DIV it is in grows due to content. You'll have to look at the page and full CSS to understand, so I've stripped everything

CSS Background Images not loading

时间秒杀一切 提交于 2019-11-30 18:04:16
问题 I've got a very strange bug in chrome recently that is when you load the page first time, or in incognito mode that none of the background images show. when you then F5 the page, the background images all load in. When you inspect the css it shows the image url in the css panel, however when you mouse over the url it doesn't display a tool tip with a preview of the image. Neither when you check the downloaded resources are there even any mention of the background-images downloading. you then

Firefox not anti-aliasing scaled background svg

左心房为你撑大大i 提交于 2019-11-30 13:54:58
I'm working on a responsive design that requires the header graphic to scale with the width of the viewport. I've gone for an svg thinking that this would scale well. (I test for svg support in the full site, and replace a gif with the svg). In Firefox (13.0 on Windows 7) it's not antialiasing it at small sizes. It occassionally looks good at some sizes, and does if I fix the dimensions, but I want to avoid doing that. Chrome and Safari do anti-alias the image, and it looks good. I'm setting the background-size: 100% 100% to scale to the container, I've tried things like cover as well, but