css-sprites

Generating CSS sprites for dynamic images

大兔子大兔子 提交于 2019-12-04 03:54:13
I have a webpage which contains about 20 - 50 dynamic images (images served from a non-static source). These images are served through a servlet based on the request URL. This results in a request being generated per image, which leads to performance decay. If these images were static, I would create a CSS sprite and replace the 50 requests with a single one. As they are dynamic this is not that easy of course. I'm looking for a tool/library/method that I can use in order to aggregate these images into a single sprite at runtime. Luckily image size is constant and the same for all, which

Hover map area sprite with jquery

99封情书 提交于 2019-12-04 01:44:56
问题 I'm working on my first actual wordpress site and i'm having some troubles with some jquery. I really hope that someone can help me out here. So what i want to do is to position my div background depending on the map area currently hovered. I found an example here: http://ubytujnaslovensku.sk/sk/ What i got: HTML: <div id="front-cubus-wrapper"> <div id="front-cubus"></div> <div id="front-cubus-hover" style="background-position: 0px 0px;" ></div> <img alt="cubus" src="/wp-content/uploads/2013

Single image file to store all the little images on a page

妖精的绣舞 提交于 2019-12-03 18:51:50
问题 In one of the recent Stackoverflow podcasts , Jeff talked about having a single image file having all of those tiny images that are all over a page and then cutting it with CSS so that all the images get displayed correctly. The whole point is to reduce the number of server requests so that the page gets loaded faster. I was like "wow, that's really cool, I could really use this in our product". My question is: How is this done with CSS? I need to load the images with background-image, but

align icons with text

前提是你 提交于 2019-12-03 16:22:54
问题 What's the best way to align icons (left) and text (right) or the opposite text on left and icon on right? Does the icon image and text have to be the same size? Ideally I would like them to be different but be on the same vertical alignment. I am using background-position css property to get the icons from a larger image. Here is how I do it now, but I am struggling with either getting them to be on the same line or be vertically aligned to the bottom. Text This is what I get after I try

Sprite height limitation for CSS images?

旧巷老猫 提交于 2019-12-03 14:44:57
I'm making a sprite and its reaching about 4000px in height. Is there a general size for maximum sprite height that is used within the graphics design community? Browsers will have to decompress (and keep in memory) the whole image even if you only use very few sprites in it, and even if most of the image is blank/white. For a desktop client you've only missed an occasion to be a good citizen by using too much memory (and browser are already sucking a lot of memory). For some mobile client (eg. IPhone for files over 25k after degzipping), it can be more problematic, the image won't be cached

IE6: Background-Image Load Event

泪湿孤枕 提交于 2019-12-03 09:59:52
I am displaying a bunch of thumbnail images and the latency can be very high (over a VPN) so I send all the thumbnails in a single file (like a sprite) and set the CSS background-image and background-position properties of a div to show the thumbnails. The problem I'm having is with IE6 and figuring out when the image has loaded... I'm using the BackgroundImageCache hack: document.execCommand("BackgroundImageCache",false,true); To check when the image is loaded I use this code: $('<img>').attr('src', 'ThumbSpriteTest.png').load(function() { $('.Thumbnails').css('background-image', 'url

CSS sprites and IE6

只愿长相守 提交于 2019-12-03 08:20:45
Does IE6 support css-sprites? Yes IE 6 supports sprites but doesn't support 24 bit PNG transparency. I use this css hack for giving IE < 7 a gif file and everything else a 24 bit png with transparency. background-image:url(/images/sprites/icons-sprite.png); _background-image:url(/images/sprites/icons-sprite.gif); /* IE<7 gets the crappy icons */ You can also use Glue http://gluecss.com/ It's an open-source command line tool to generate sprites. CSS sprites is a general solution using backround-position, which is avaible even in IE5. A good tutorial about them is located here: http://www

Is there an equivalent of spriting for SVG images in web pages?

偶尔善良 提交于 2019-12-03 06:24:47
SVG images aren’t bitmaps, so (unless I’m missing something) you can’t do spriting like you can with other images files used on web pages (see http://www.alistapart.com/articles/sprites ). But is there an equivalent mechanism to display only part of an SVG image as a CSS background? E.g. imaginary syntax: div.my-special-svg-div { background-image: url(sprite-image.svg#one-shape-in-the-svg-file); } You can use 'traditional' CSS sprite techniques to slice up SVG images with background position, here's a quick example , though it does get a little confusing if you also start using background-size

align icons with text

佐手、 提交于 2019-12-03 04:48:54
What's the best way to align icons (left) and text (right) or the opposite text on left and icon on right? Does the icon image and text have to be the same size? Ideally I would like them to be different but be on the same vertical alignment. I am using background-position css property to get the icons from a larger image. Here is how I do it now, but I am struggling with either getting them to be on the same line or be vertically aligned to the bottom. Text This is what I get after I try your suggestions. Though the text is now aligned with the icon, it is superimposed over the icon to the

Is using the logo tag in sprites good or bad?

假装没事ソ 提交于 2019-12-03 01:19:01
When building web pages, one of my colleagues displays any logo using the CSS background-image property, rather than embedding the image using an HTML <img> tag. The colleague reported it was to reduce the number of HTTP requests. He also showed me an image sprite and said that Google displays its logo with sprite images. I don't agree with his approach and showed him that the main Google.com page loads their logo in an <img> tag. Which is a better practice? EDIT: Facebook also do the same thing on their homepage , loading the logo in an img tag while on their profile pages they display their