<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>DesignWalker &#187; sprite</title>
	<atom:link href="http://www.designwalker.com/tag/sprite/feed" rel="self" type="application/rss+xml" />
	<link>http://www.designwalker.com</link>
	<description>ロサンゼルスで働くウェブデザイナーの日記。</description>
	<lastBuildDate>Wed, 29 Jun 2011 06:24:51 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.designwalker.com/tag/sprite/feed" />
		<item>
		<title>CSS Spriteを活用しよう</title>
		<link>http://www.designwalker.com/2008/02/css-sprite.html</link>
		<comments>http://www.designwalker.com/2008/02/css-sprite.html#comments</comments>
		<pubDate>Sat, 16 Feb 2008 20:20:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[サイトを紹介する男]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[sprite]]></category>
		<category><![CDATA[まとめ]]></category>
		<category><![CDATA[テクニック]]></category>

		<guid isPermaLink="false">http://new.designwalker.com/2008/02/css-sprite%e3%82%92%e6%b4%bb%e7%94%a8%e3%81%97%e3%82%88%e3%81%86.html</guid>
		<description><![CDATA[
			
				
			
		
みなさんお馴染みのYouTube
このYouTubeのプレーヤーに使われている画像は実は↓のような一枚の画像が用意されていて、スタイルでうまく表示されているようです。



画像をスライ [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.designwalker.com%2F2008%2F02%2Fcss-sprite.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.designwalker.com%2F2008%2F02%2Fcss-sprite.html&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>みなさんお馴染みの<a title="YouTube" href="http://youtube.com/">YouTube</a></p>
<p>このYouTubeのプレーヤーに使われている画像は実は↓のような一枚の画像が用意されていて、スタイルでうまく表示されているようです。</p>
<p align="center"><a title="YouTube" href="http://youtube.com/"><br />
<img src="http://www.designwalker.com/img/css_sprite/css_sprite01.jpg" border="0" alt="YouTube" /><br />
</a></p>
<p>画像をスライスして一枚ずつ読み込むよりも、このように一枚の画像にすると、スライスの手間が省けるのと、読み込みの再に、リクエストが一回で済むので、場合によってはこちらの方が早く読み込まれることになりそうです。</p>
<p>このテクニックをCSS Spriteって言うそうです。。（この手法自体は知ってましたが、CSS Spriteって呼ばれているのは知りませんでした…）</p>
<p>せっかくなので、本日はCSS Spriteをいろいろとまとめてみました。</p>
<h4>1. <a title="CSS Sprites: What They Are, Why They’re Cool, and How To Use Them" href="http://css-tricks.com/css-sprites-what-they-are-why-theyre-cool-and-how-to-use-them/">CSS Sprites: What They Are, Why They’re Cool, and How To Use Them</a></h4>
<p>一枚ずつ画像をスライスした場合と、CSS Spriteを使った場合の比較をされています。<br />
サンプルのコードも公開されているので、わかりやすいですね。</p>
<p align="center"><a title="CSS Sprites: What They Are, Why They’re Cool, and How To Use Them" href="http://css-tricks.com/css-sprites-what-they-are-why-theyre-cool-and-how-to-use-them/"><br />
<img src="http://www.designwalker.com/img/css_sprite/css_sprite02.jpg" border="0" alt="CSS Sprites: What They Are, Why They’re Cool, and How To Use Them" /><br />
</a></p>
<p>一枚の画像をCSSのbackground-positionで表示してみると。</p>
<p align="center"><a title="CSS Sprites: What They Are, Why They’re Cool, and How To Use Them" href="http://css-tricks.com/css-sprites-what-they-are-why-theyre-cool-and-how-to-use-them/"><br />
<img src="http://www.designwalker.com/img/css_sprite/css_sprite03.jpg" border="0" alt="CSS Sprites: What They Are, Why They’re Cool, and How To Use Them" /><br />
</a></p>
<p>結果、HTTPリクエストは1回、トータルの画像サイズも7KBほど短縮されています。</p>
<h4>2. <a title="Image Sprite Navigation With CSS" href="http://stylemeltdown.com/2007/10/22/image-sprite-navigation-with-css/">Image Sprite Navigation With CSS</a></h4>
<p>メニューのロールオーバーにCSS Spriteを使うのが一番分かりやすい例ですね。</p>
<p>↓のようにオーバーの画像もまとめて、一枚画像を用意して、hoverのbackground-positionを変更。</p>
<p align="center"><a title="Image Sprite Navigation With CSS" href="http://stylemeltdown.com/2007/10/22/image-sprite-navigation-with-css/"><br />
<img src="http://www.designwalker.com/img/css_sprite/css_sprite04.jpg" border="0" alt="Image Sprite Navigation With CSS" /><br />
</a></p>
<h4>3. <a title="Advanced CSS Menu" href="http://www.webdesignerwall.com/tutorials/advanced-css-menu/">Advanced CSS Menu</a></h4>
<p><a title="WebDesignerWall" href="http://www.webdesignerwall.com/">WebDesignerWall</a>さんのメニューもとってもきれいですね。ファイルもダウロードできるので便利です。</p>
<p align="center"><a title="Advanced CSS Menu" href="http://www.webdesignerwall.com/tutorials/advanced-css-menu/"><br />
<img src="http://www.designwalker.com/img/css_sprite/css_sprite05.jpg" border="0" alt="Advanced CSS Menu" /><br />
</a></p>
<h4>4. <a title="Dragon Interactive" href="http://dragoninteractive.com/">Dragon Interactive</a></h4>
<p><a title="jQuery" href="http://jquery.com/">jQuery</a>とCSS Spriteを使った例。とってもきれいなメニューですね。</p>
<p align="center"><a title="Dragon Interactive" href="http://dragoninteractive.com/"><br />
<img src="http://www.designwalker.com/img/css_sprite/css_sprite06.jpg" border="0" alt="Dragon Interactive" /><br />
</a></p>
<p>↓このような画像が用意されています。</p>
<p align="center"><a title="Dragon Interactive" href="http://dragoninteractive.com/"><br />
<img src="http://www.designwalker.com/img/css_sprite/css_sprite07.jpg" border="0" alt="Dragon Interactive" /><br />
</a></p>
<h4>5. <a title="JavaScript Sprite Animation Using jQuery" href="http://www.sitepoint.com/blogs/2007/07/20/javascript-sprite-animation-using-jquery/">JavaScript Sprite Animation Using jQuery</a></h4>
<p>こちらも<a title="jQuery" href="http://jquery.com/">jQuery</a>とCSS Spriteでページをパラパラとめくるような効果を出しています。</p>
<p>↓のような全ページの画像を一枚用意して。</p>
<p align="center"><a title="JavaScript Sprite Animation Using jQuery" href="http://www.sitepoint.com/blogs/2007/07/20/javascript-sprite-animation-using-jquery/"><img src="http://www.designwalker.com/img/css_sprite/css_sprite08.jpg" border="0" alt="JavaScript Sprite Animation Using jQuery" /><br />
</a></p>
<p>↓のようなページをめくる時の画像と組み合わせています。</p>
<p align="center"><a title="JavaScript Sprite Animation Using jQuery" href="http://www.sitepoint.com/blogs/2007/07/20/javascript-sprite-animation-using-jquery/"><img src="http://www.designwalker.com/img/css_sprite/css_sprite09.jpg" border="0" alt="JavaScript Sprite Animation Using jQuery" /><br />
</a></p>
<p>デモページは<a title="Page Turner Test" href="http://www.sitepoint.com/examples/jquery/animate4.php">こちら</a></p>
<p>ページ右側をクリックすると次のページに、左側をクリックすると前のページにめくれたように見えますね～。</p>
<h4>6. <a title="CSS Sprite Generator" href="http://spritegen.website-performance.org/">CSS Sprite Generator</a></h4>
<p>もう既に画像スライスしちゃったよ～！って方にお勧めなのが、こちらのCSS Sprite Generator。スライスした画像をフォルダにまとめて、ZIPで圧縮して、このジェネレーターにアップロードすると、一枚の画像を作ってくれて、CSSも生成してくれる優れものです。</p>
<p align="center"><a title="CSS Sprite Generator" href="http://spritegen.website-performance.org/"><img src="http://www.designwalker.com/img/css_sprite/css_sprite10.jpg" border="0" alt="CSS Sprite Generator" /><br />
</a></p>
<p>みなさんもCSS Spriteを活用してみてはいかがでしょう？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designwalker.com/2008/02/css-sprite.html/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.designwalker.com/2008/02/css-sprite.html" />
	</item>
	</channel>
</rss>

