background-image

Fill SVG path element with a background image without tiling or scaling

柔情痞子 提交于 2019-11-28 21:29:06
I'd like to do something very much like Fill SVG path element with a background-image except that the solution offered there will tile the image to fill the the entire background area. I don't want that. If the image doesn't fill either the entire height or the entire width, then I'd just like it to center within the path shape and let that be that. If I try to restrict the behavior by changing the height/width attributes, then the rendering just scales the image until it fills at least one of the dimensions. I guess this behavior somewhat makes sense since it uses patterns. I can see that

How to set the background image of a html 5 canvas to .png image

China☆狼群 提交于 2019-11-28 21:06:21
问题 I would like to know how it is possible to set the background image of a canvas to a .png file. I do not want to add the image in the back of the canvas and make the canvas transparent. I want the user to be able to actually draw on that canvas with the background being the .png image so that I can extract it later as a .png with the drawings that the user made. 回答1: As shown in this example, you can apply a background to a canvas element through CSS and this background will not be considered

Bootstrap carousel as website background

↘锁芯ラ 提交于 2019-11-28 20:53:28
I'm using twitter bootstrap carcass for my web project development. Currently I have full screen background image which I set for the body tag like: body { background: url('Content/images/planet.gif') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } It looks nice, and resizing works perfectly when I'm trying to change browser window size. Now I would like to add some visual effects to my website by adding background carousel. Is there way to implement standard bootstrap carousel to the whole

Image in full screen with img tag

做~自己de王妃 提交于 2019-11-28 20:33:30
问题 I am using the img tag for my slider images, I need the image to be full width and height and centered inside its' container. My problem is when I resize the window width, my image becomes small and it's height doesn't follow the window height. I need the same behaviour as background-size: cover but with the image tag . background: url(../images/slider/002.jpg) center center; background-size: cover; If I make the image as background, everything works fine, but the slider will not. I need to

Reference app relative virtual paths in .css file

怎甘沉沦 提交于 2019-11-28 20:03:11
问题 Assume I have an "images" folder directory under the root of my application. How can I, from within a .css file, reference an image in this directory using an ASP.NET app relative path. Example: When in development, the path of ~/Images/Test.gif might resolve to /MyApp/Images/Test.gif while, in production, it might resolve to /Images/Test.gif (depending on the virtual directory for the application). I, obviously, want to avoid having to modify the .css file between environments. I know you

Calculating Viewport Height on Chrome Android with CSS

你离开我真会死。 提交于 2019-11-28 18:25:36
So I noticed that mobile Chrome calculates the address bar into the viewport height. Because of this using height: 100vh on an element doesn't work because when the address bar scrolls the viewport height changes. I was actually able to find a question that had the same issue here on ios, but after investigating further I realized that this happens on all mobile Chrome browsers. When the address bar scrolls out of the viewport and then again when scrolls into the viewport, the viewport height changes. This causes any element using vh to recalculate which makes the page jump. It's extremely

iOS: Preparing background images for applications

陌路散爱 提交于 2019-11-28 17:50:52
问题 Mostly every iOS application has a view with an image as background. Is there any image sizing guide out there? For example here is an iOS screen designed in Sketch: As you can see there is a background image. Now there are lots of Apple devices every application should support. The new iOS 10 supports all devices from iPhone 5 to iPhone 6s Plus. They have different screen sizes and resolutions. When creating Xcode assets, I am giving 3 background images with different sizes - @1x, @2x, @3x .

CSS fading top and bottom “borders”

感情迁移 提交于 2019-11-28 17:37:35
Take a look at this : http://jsfiddle.net/wjhnX/ I achieved it with this CSS : background-image: radial-gradient(#CCC, #FFF), radial-gradient(#CCC, #FFF); background-size: 2px 100%; background-position: 0 0, 100% 0; background-repeat: no-repeat; Is this possible to do but the simulated borders would be top and bottom, not left and right ? Thanks ahead ! Do you want something like this? Demo (Some breathing space for your content, I've used margin there, just make sure that it will apply to both, :before as well as :after , so if you want to separate, declare margin separately for each, p.s - I

Is there a srcset equivalent for css background image

↘锁芯ラ 提交于 2019-11-28 15:14:35
问题 img with srcset attribute looks like a great way of doing responsive images. Is there an equivalent syntax that works in css background-image property? HTML <img src="small.jpg" srcset="medium.jpg 1000w, large.jpg 2000w" alt="yah"> CSS .mycontainer { background: url(?something goes here?); } 回答1: image-set is the equivalent CSS feature. We should add equivalent srcset functionality (defining resources according to their dimensions) to the spec. Currently it's only implemented in Safari,

Why doesn't -moz-background-size:cover work in Firefox?

南笙酒味 提交于 2019-11-28 14:12:35
I'm coding a site that contains 3 wide images which need to have 100% width at all times. I'm using media queries and I would rather not have to make 3+ copies of each image to make them fit. This is the CSS I want on the images: #artwork1 { width: 1500px; height:500px; background-image: url(../img/menupic_1.png); background-repeat:no-repeat; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; } Here is a jsFiddle link: http://jsfiddle.net/RtPEA/ . The link just contains the three <div> s that need a background that resizes. I have used background-size:cover