<?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/"
	>

<channel>
	<title>Snippet-Editor.com &#187; CSS</title>
	<atom:link href="http://snippet-editor.com/category/css/feed" rel="self" type="application/rss+xml" />
	<link>http://snippet-editor.com</link>
	<description>仕事で使えるHTML5・CSS3などのナイスなアイデアを収集しています。（一緒に投稿していただける方を募集中です）</description>
	<lastBuildDate>Sun, 10 Jul 2011 02:57:44 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTMLの骨組みが見える、デバッグ用CSS</title>
		<link>http://snippet-editor.com/2010/10/xray-debug-css.html</link>
		<comments>http://snippet-editor.com/2010/10/xray-debug-css.html#comments</comments>
		<pubDate>Tue, 05 Oct 2010 15:37:44 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[RGBA]]></category>
		<category><![CDATA[デバッグ]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1412</guid>
		<description><![CDATA[HTMLの骨組みが見える、デバッグ用CSSです。RGBAを使って色を指定しているので、重なっているところはより濃く見えます。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
* { outline: 2px solid rgba(255, 0, 0, 0.1) !important; }
</pre>
<p><span id="more-1412"></span></p>
<p>あまり実用的でないかもしれませんが、かっこよかったのでポスト。</p>
<p>RGBAを使って色を指定しているので、重なっているところはより濃く見えます<sup>[<a href="#note">1</a>]</sup>。</p>
<p>全称セレクタをやめれば、特定の部位にだけ線を引くこともできます。</p>
<pre class="brush: css;">
YOUR-ELEMENT { outline: 2px solid rgba(255, 0, 0, 0.1) !important; }
</pre>
<ol class="note" id="note">
<li>IE6で見ても何も起こりませんのであしからず…</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/10/xray-debug-css.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>等幅フォントが小さく表示されるのを防ぐ</title>
		<link>http://snippet-editor.com/2010/09/fix-monospace-font-size.html</link>
		<comments>http://snippet-editor.com/2010/09/fix-monospace-font-size.html#comments</comments>
		<pubDate>Wed, 29 Sep 2010 16:15:19 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[font-size]]></category>
		<category><![CDATA[等幅フォント]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1376</guid>
		<description><![CDATA[CSSで等幅フォントを指定すると一部のブラウザが文字を小さめにレンダリングするのを防ぐ方法をご紹介。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
YOUR-ELEMENT { font-family: &quot;Courier New&quot;, Courier, sans-serif; }
</pre>
<p><span id="more-1376"></span></p>
<p>CSSで等幅フォントを指定すると一部のブラウザが文字を小さめにレンダリングしてしまうのを防ぐ方法をご紹介します。</p>
<p>通常は下のようにお尻に&quot;monospace&quot;と書きますが、これを&quot;sans-serif&quot;にするだけです<sup>[<a href="#note">1</a>]</sup>。</p>
<pre class="brush: css;">
YOUR-ELEMENT { font-family: &quot;Courier New&quot;, Courier, monospace; }
</pre>
<p>&quot;Courier New&quot;や&quot;Courier&quot;はかなり昔のコンピュータにもインストールされているので、&quot;sans-serif&quot;の記述に関わらず、実際には等幅フォントが当たり、かつ文字が小さくなる問題も解消することができます。</p>
<p>等幅フォントの追加はお好みで。当サイトでは先頭に&quot;<a href="http://www.google.com/search?q=フォント+Menlo" target="_blank">Menlo</a>&quot;を追加しています。</p>
<pre class="brush: css;">
code { font-family: Menlo, &quot;Courier New&quot;, Courier, sans-serif; }
</pre>
<ol class="note" id="note">
<li>原理的には間違った記述ですが、現実的には問題解決していますので、後はご判断ください…。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/fix-monospace-font-size.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3で書いて、スクリーンショットを取って、ボタンにする</title>
		<link>http://snippet-editor.com/2010/09/button-image-made-with-css3.html</link>
		<comments>http://snippet-editor.com/2010/09/button-image-made-with-css3.html#comments</comments>
		<pubDate>Tue, 28 Sep 2010 13:19:48 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[CSS画像置換]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1357</guid>
		<description><![CDATA[CSS3を使えばPhotoshopやFireworksでやるような作業を代行できます。後はスクリーンショットを取るだけです。]]></description>
			<content:encoded><![CDATA[<pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html dir=&quot;ltr&quot; lang=&quot;ja&quot;&gt;
&lt;head&gt;
&lt;meta charset=&quot;utf-8&quot; /&gt;
&lt;title&gt;Safari CSS3 Button&lt;/title&gt;
&lt;style&gt;
body { font-size: 12px; font-family: &quot;Lucida Grande&quot;, sans-serif; -webkit-text-stroke: 1px transparent; background: #aaa; padding: 20px; margin: 0; }
ul { clear: both; float: left; width: 100%; padding: 0; margin: 0; }
ul li { clear: both; float: left; list-style-position: outside; list-style-type: none; background: #fff; padding: 2px; margin: 0 3px; }

a:link,
a:visited { color: #fff; font-weight: bold; text-decoration: none; text-align: center; line-height: 1.1; background: #1f5c99; float: left; -webkit-border-radius: 5px; padding: 1px; margin: 0; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); }
a:link span,
a:visited span { text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.4); float: left; border: 1px solid hsla(0, 0%, 100%, 0.33); border-top-color: hsla(0, 0%, 100%, 0.66); border-bottom: none; -webkit-border-radius: 4px; padding: 0.2em 1.4em 0.3em; margin: 0;}

a:hover,
a.hover,
a.active { -webkit-box-shadow: none; }
a.hover,
a.active { cursor: default; }

a.link:link span,
a.link:visited span { background: -webkit-gradient(linear, left top, left bottom, from( hsla(0, 0%, 100%, 0.4)), color-stop(0.5, hsla(0, 0%, 100%, 0.2)), color-stop(0.5, hsla(0, 0%, 100%, 0.1)), to( hsla(0, 0%, 100%, 0.2))); }
a.hover span,
a.link:hover span { background: -webkit-gradient(linear, left top, left bottom, from( hsla(0, 0%, 100%, 0.5)), color-stop(0.5, hsla(0, 0%, 100%, 0.25)), color-stop(0.5, hsla(0, 0%, 100%, 0.25)), to( hsla(0, 0%, 100%, 0.2))); }
a.active,
a.link:active { background: -webkit-gradient(linear, left top, left bottom, from( hsl(0, 0%, 10%)), color-stop(0.25, hsl(0, 0%, 20%)), to( hsl(0, 0%, 33%))); }
a.active span,
a.link:active span { text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); background: none; border-color: transparent; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;#null&quot; class=&quot;link&quot;&gt;&lt;span&gt;Download&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;#null&quot; class=&quot;hover&quot;&gt;&lt;span&gt;Download&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;#null&quot; class=&quot;active&quot;&gt;&lt;span&gt;Download&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><span id="more-1357"></span></p>
<p>上のコードをSafariで実行する<sup>[<a href="#note">1</a>]</sup>と以下のようなスクリーンショットが撮れます。</p>
<p class="center"><img src="http://media.snippet-editor.com/2010/09/button-image-made-with-css3-screenshot.png" alt="Screenshot" /></p>
<p>これをフォトショップで開いて、「イメージ」メニューから「トリミング…」を実行します。</p>
<p class="center"><img src="http://media.snippet-editor.com/2010/09/button-image-made-with-css3-triming.png" alt="「トリミング…」" class="png" /></p>
<p>これでボタン用画像の完成です。</p>
<p class="center"><img src="http://media.snippet-editor.com/2010/09/button-image-made-with-css3-download.png" alt="Download" /></p>
<p>実際にアプライするとこうなります。</p>
<div class="center" style="width: 102px;"><a href="#null" class="replace" style="width: 102px; height: 25px;">Download<span class="image active" style="background-image: url(http://media.snippet-editor.com/2010/09/button-image-made-with-css3-download.png);"></span></a></div>
<p>基本HTMLなので文字や色なども簡単に変更可能です。</p>
<ol class="note" id="note">
<li>開発メニューから「スニペットエディタ」を開いてコピペするのが簡単です。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/button-image-made-with-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3のMedia Queryを使ってFollowバッジが被らないようにする</title>
		<link>http://snippet-editor.com/2010/09/media-query-max-width.html</link>
		<comments>http://snippet-editor.com/2010/09/media-query-max-width.html#comments</comments>
		<pubDate>Wed, 22 Sep 2010 09:26:46 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[media-query]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1230</guid>
		<description><![CDATA[CSS3のMedia Queryを使えば、ウィンドウが所定のサイズを下回った際に「Follow me」バッジを自動的に非表示にすることができます。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
@media only screen and (max-width: 960px) {
div#twitterFollowBadge { display: none; }
}
</pre>
<p><span id="more-1230"></span></p>
<p>遅ればせながら「Follow me」バッジを付けてみました。</p>
<p>で、多少気になるのがウィンドウサイズを狭めた際に、バッジがコンテンツにかぶること。</p>
<p>CSS3のMedia Queryを使えば、所定のサイズを下回った際に自動的に非表示にすることができます。</p>
<p>SafariやChromeなど対応ブラウザでご確認ください。</p>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/media-query-max-width.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3を待たないでも使える伸び縮みするボタン</title>
		<link>http://snippet-editor.com/2010/09/handy-large-button.html</link>
		<comments>http://snippet-editor.com/2010/09/handy-large-button.html#comments</comments>
		<pubDate>Mon, 20 Sep 2010 23:31:45 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS2]]></category>
		<category><![CDATA[ボタン]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1135</guid>
		<description><![CDATA[ひとつ作っておくと何かと便利な大きめのボタンです。CSS2.1だけで実装してあるので、IE6でも問題なく使用できます。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
p.button { clear: both; font-weight: bold; text-align: center; }
p.button a,
p.button span { display: inline-block; line-height: 43px; height: 45px; background: url(../images/button.png) no-repeat; }
p.button a { text-decoration: none; padding-left: 25px; }
p.button span { background-position: right top; padding-right: 45px; }
p.button a:hover { background-position: left bottom; }
p.button a:hover span { background-position: right bottom; }
</pre>
<p><span id="more-1135"></span></p>
<p>ひとつ作っておくと何かと便利な大きめのボタンです。CSS2.1だけで実装してあるので、IE6でも問題なく使用できます<sup>[<a href="#note">1</a>]</sup>。</p>
<p class="button"><a href="#null"><span>文字の量に応じて伸び縮み</span></a></p>
<p>HTMLのコードはp.button a spanと、比較的平易なコンビネーションにしてあります。</p>
<pre class="brush: xml;">
&lt;p class=&quot;button&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;TEXT HERE&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
</pre>
<p>使用している画像も一点だけなので、適宜作り直してカスタマイズしてみてください<sup>[<a href="#note">2</a>]</sup>。</p>
<p class="button"><a href="http://media.snippet-editor.com/2010/09/handy-large-button.png" target="_blank"><span>画像を表示</span></a>　<a href="http://media.snippet-editor.com/2010/09/handy-large-button.zip"><span>ダウンロード</span></a></p>
<ol class="note" id="note">
<li>display: inline-block;を使用している関係上、Firefox 2.xはサポートしていません。</li>
<li>画像を1点で済ませている関係上、透過している画像には変更できません。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/handy-large-button.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>プラグインなしでiPhoneとiPadにサイトを最適化する簡単な方法</title>
		<link>http://snippet-editor.com/2010/09/optimised-for-ios-deveices-without-plugin.html</link>
		<comments>http://snippet-editor.com/2010/09/optimised-for-ios-deveices-without-plugin.html#comments</comments>
		<pubDate>Mon, 20 Sep 2010 01:19:56 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[handheld.css]]></category>
		<category><![CDATA[iPadサイト]]></category>
		<category><![CDATA[iPhoneサイト]]></category>
		<category><![CDATA[viewport]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1078</guid>
		<description><![CDATA[WordPressはプラグインを使うことで簡単にiPhoneサイトを構築することができますが、コツをつかめばプラグインなしでも簡単に最適化できます。]]></description>
			<content:encoded><![CDATA[<pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=1024&quot;&gt;
&lt;style&gt;
@media only screen and (max-device-width: 480px) {
body { font-size: 1.6em; }
div.body { width: 1024px; }
div.aside { display: none; }
div.article { float: none; width: auto; }
}
&lt;/style&gt;
&lt;body&gt;
&lt;div class=&quot;body&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><span id="more-1078"></span></p>
<p>WordPressのプラグインを使わずに、サイトをiPhoneとiPadに最適化する方法をご紹介します。</p>
<p>世間で良く知られている手法とは異なり、ピンチで拡大縮小ができなくなる問題を回避してあります。</p>
<h3>Step 1、まずはiPadに最適化</h3>
<p>iPadは一昔前のPCと変わらない画面サイズを持っていますので、あなたのサイトの横幅が1024px以下なら、難しい作業をする必要は特にありません。下の1行を追加するだけです。</p>
<pre class="brush: xml;">
&lt;meta name=&quot;viewport&quot; content=&quot;width=1024&quot;&gt;
</pre>
<p>これでiPadがサイトを正確にレンダリングするようになりました（詳しくは<a href="/2010/08/viewport-equal-1024.html" title="WebサイトをiPadに最適化させる1行">こちら</a>）。</p>
<h3>Step 2、iPhoneに最適化</h3>
<p>続いてiPhoneでアクセスした時だけ、サイトの横幅が1024pxになるように調節します。</p>
<pre class="brush: css;">
@media only screen and (max-device-width: 480px) {
div.body { width: 1024px; }
}
</pre>
<p>やや変に聞こえるかもしれませんが、Step 1ではサイトの横幅は特にいじっていません。iPadに正確にレンダリングするよう指示しただけです。Step 2ではじめて、サイトの横幅を調整しています。</p>
<p>もしあなたのサイトが横幅960pxだとしたら、iPhoneで閲覧する時だけ1024pxに拡大することになります。方法はいろいろあると思いますが、ここではdiv.bodyを使って調整しています（div.bodyについては<a href="/2010/09/nowrap-fixed-width.html" title="wrapしないで固定幅のページを作る">こちら</a>）。</p>
<h3>Step 3、CSSを調整</h3>
<p>基本的な準備が整いましたので、あとはiPhone用のスタイルシートを詰めていきます。</p>
<pre class="brush: css;">
@media only screen and (max-device-width: 480px) {
body { font-size: 1.6em; }
div.aside { display: none; }
div.article { float: none; width: auto; }
}
</pre>
<p>サイドバーを非表示にし、シングルカラムのデザインになるようにします。また、何もしないと文字がとても小さいくて読めませんので、bodyタグのfont-sizeを大きくしておきます。</p>
<p>その他、iPhoneで表示してみて気になる箇所を修正していき、最終的に当サイトではこのようになりました（<a href="http://media.snippet-editor.com/shared/css/handheld.css" target="_blank">handheld.cssを表示</a>）<sup>[<a href="#note">1</a>]</sup>。</p>
<ol class="note" id="note">
<li>当サイトは横幅が768px以下なので、Viewportは&quot;1024&quot;ではなく&quot;768&quot;にして調整してあります。</li>
</ol>
<p>このスタイルシートがどのように表示されるかは、実際にiPhoneやiPadでアクセスして、確認してみてください。</p>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/optimised-for-ios-deveices-without-plugin.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3のborder-radiusを扱いやすくする</title>
		<link>http://snippet-editor.com/2010/09/css3-border-radius-classname.html</link>
		<comments>http://snippet-editor.com/2010/09/css3-border-radius-classname.html#comments</comments>
		<pubDate>Fri, 17 Sep 2010 03:53:47 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[border-radius]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=999</guid>
		<description><![CDATA[CSS3のborder-radiusが普通に使える状況が近づいてきましたが、いかんせんコードが長いのでスタイルシートが汚れがちです。そこで再利用可能なclassにしたいと思いますが、命名はどうしましょう。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
.r10 { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; }
.r20 { -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; }
.r30 { -webkit-border-radius: 30px; -moz-border-radius: 30px; border-radius: 30px; }
</pre>
<p><span id="more-999"></span></p>
<p>CSS3のborder-radiusが普通に使える状況が近づいてきましたが、いかんせんコードが長いのでスタイルシートが汚れがちです。そこで再利用可能なclassにしたいと思いますが、命名はどうしましょう。</p>
<p>むやみやたらにclassを作ると将来のリニューアルで苦労しますが、おそらくこの名前なら.leftや.rightのように末永くお付き合いできそうな気がします。</p>
<pre class="brush: css;">
.r5 { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; }
.r10 { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; }
.r15 { -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; }
.r20 { -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; }
.r25 { -webkit-border-radius: 25px; -moz-border-radius: 25px; border-radius: 25px; }
.r30 { -webkit-border-radius: 30px; -moz-border-radius: 30px; border-radius: 30px; }
</pre>
<p>子要素のaにだけ適応したい場合は、こう。</p>
<p class="note">Safariをお使いの方は、開発メニューのスニペットエディタにコピペしてご確認いただけます。</p>
<pre class="brush: xml; highlight: [8,12];">
&lt;!DOCTYPE html&gt;
&lt;meta charset=&quot;utf-8&quot;&gt;
&lt;title&gt;CSS3 Border Radius&lt;/title&gt;
&lt;style&gt;
ul li { float: left; list-style: none; padding-right: 10px; }
ul li a { color: #fff; text-decoration: none; background: #000; padding: 0 1em; }
ul li a:hover { background: #999; }
.r10-a a { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul class=&quot;r10-a&quot;&gt;
    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;item 1&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;item 2&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;item 3&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;item 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>ボックスの上だけを角丸にしたい場合（または下だけ）は、こうでどうでしょう。</p>
<pre class="brush: css;">
.r5500 {
	-webkit-border-top-left-radius: 5px;
	-webkit-border-top-right-radius: 5px;
	-moz-border-radius-topleft: 5px;
	-moz-border-radius-topright: 5px;
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
}
.r0055 {
	-webkit-border-bottom-right-radius: 5px;
	-webkit-border-bottom-left-radius: 5px;
	-moz-border-radius-bottomright: 5px;
	-moz-border-radius-bottomleft: 5px;
	border-bottom-right-radius: 5px;
	border-bottom-left-radius: 5px;
}
</pre>
<p class="center"><img src="http://media.snippet-editor.com/2010/09/css3-border-radius-classname.png" alt="Sample"></p>
<p>左上を基準にして時計回りに数字を並べています。</p>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/css3-border-radius-classname.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>最新のbase.cssをサイドバー上で公開中</title>
		<link>http://snippet-editor.com/2010/09/shared-base-css.html</link>
		<comments>http://snippet-editor.com/2010/09/shared-base-css.html#comments</comments>
		<pubDate>Tue, 14 Sep 2010 01:36:21 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[base.css]]></category>
		<category><![CDATA[reset.css]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=881</guid>
		<description><![CDATA[Reset CSSやStyled CSSを含む最新のbase.cssをサイドバーで公開します。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
/* RESET */
/* PREFERENCES */
/* REBUILD */
/* CLASSES */
</pre>
<p><span id="more-881"></span></p>
<p>Reset CSSやStyled CSSを含む最新のbase.cssを、サイドバーのShared CSSのところで公開しています。</p>
<pre class="brush: css;">
@charset &quot;utf-8&quot;;

/* ----------------------------------------------------------------------------
	RESET
   ---------------------------------------------------------------------------- */
body { color: #000; background: #fff; }

h1, h2, h3, h4, h5, h6, input, select, textarea { font-size: 100%; }
h1, h2, h3, h4, h5, h6, b, em, strong, dt, th, caption { font-weight: normal; }
em, address, optgroup, cite { font-style: normal; }
caption { text-align: left; }

body, div, h1, h2, h3, h4, h5, h6, p, img, ul, ol, li, dl, dt, dd, table, th, td, thead, tbody, tfoot, caption, blockquote, pre, address, form, fieldset, legend, iframe { border: none; outline: none; padding: 0; margin: 0; }

li { list-style-position: outside; }
ul li { list-style-type: none; }

table { width: 100%; border-collapse: collapse; border-spacing: 0; }
th, td { text-align: left; vertical-align: top; border: 1px solid #000; }

pre { overflow-x: auto; }
textarea { width: 99%; overflow: auto; }
iframe { display: block; width: 100%; overflow: hidden; }

a:hover { cursor: pointer; background-color: transparent; }
a:active,
a:focus { outline: none; }

sup { font-size: 71.5%; vertical-align: baseline; position: relative; bottom: 0.7em; }
sub { font-size: 71.5%; vertical-align: baseline; position: relative; top: 0.1em; }

abbr, acronym { border-bottom: 1px dotted; cursor: help; }

hr { display: none; }

@media screen and (max-device-width: 480px) {
body { -webkit-text-size-adjust: none; }
}

/* ----------------------------------------------------------------------------
	PREFERENCES
   ---------------------------------------------------------------------------- */
html { overflow-y: scroll; }
body { font-size: 81.25%; }

body, input, textarea, legend { color: #222; }
del { color: #888; }

body, textarea { font-family: &quot;Lucida Grande&quot;, &quot;メイリオ&quot;, &quot;ＭＳ Ｐゴシック&quot;, sans-serif; }
input, select { font-family: &quot;Lucida Grande&quot;, Arial, &quot;ＭＳ Ｐゴシック&quot;, sans-serif; }
code { font-family: Menlo, &quot;Courier New&quot;, Courier, monospace; }
b, em, strong, dt, th, caption { font-weight: bold; }

a:link { color: #359; text-decoration: none; }
a:visited { color: #649; text-decoration: none; }
a:hover { text-decoration: underline; }
a:hover img { opacity: 0.8; filter: alpha(opacity=80); -ms-filter: &quot;alpha(opacity=80)&quot;; }

label { cursor: pointer; }

/* ----------------------------------------------------------------------------
	REBUILD
   ---------------------------------------------------------------------------- */
@media screen and (max-device-width: 480px) {
body .styled { -webkit-text-size-adjust: 125%; }
}

.styled p { line-height: 1.6em; width: 80%; margin: 0 auto 1em; }

.styled h1,
.styled h2 { font-size: 123.3%; line-height: 1.25; margin-bottom: 0.65em; }
.styled h3 { clear: both; color: #359; font-size: 123.3%; line-height: 1.3; padding: 0.5em 0 0 1em; margin-bottom: 1em; }
.styled h4 { font-size: 1.1em; line-height: 1.4; padding-top: 0.5em; margin-bottom: 0.5em; }
.styled h5,
.styled h6,
.styled dt,
.styled caption { line-height: 1.4; padding-top: 0.25em; padding-bottom: 0.3em; }

.styled table { clear: both; margin: 0 auto 1.4em; }
.styled th,
.styled td { font-size: 92.5%; line-height: 1.5; border-color: #aaa; padding: 0.6em 8px 0.5em; }
.styled th { text-align: center; vertical-align: middle; background: #ececff; }
.styled td { background: #fff; }

.styled ul,
.styled ol,
.styled dl { margin-bottom: 1em; }
.styled ul li,
.styled ol li,
.styled dl dd { line-height: 1.5; width: 80%; margin: 0 auto 0.3em; }
.styled ul li,
.styled dl dd { display: list-item; list-style-type: square; }
.styled dl dt { margin-top: 0.5em; }

.styled blockquote { clear: both; color: #1565bc; line-height: 1.5; width: 80%; border-left: 2px solid #144fae; padding: 0.5em 0 1px; margin: 0 auto 1.3em; }
.styled blockquote p { line-height: inherit; width: auto; padding-left: 15px; margin-bottom: 0.5em; }
.styled blockquote cite { padding-left: 1em; }

.styled div.hr { clear: both; width: 66%; height: 0; line-height: 0; margin: 2.5em auto; border-top: 1px solid #aaa; }

/* ----------------------------------------------------------------------------
	CLASSES
   ---------------------------------------------------------------------------- */
.left { float: left; }
.right { float: right; }
.clear { clear: both; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.center * { text-align: left; }

div.styled li span.date { color: #888; font-size: 92.5%; }
div.styled ol.note { color: #888; font-size: 85%; border-top: 1px solid #ccc; padding-top: 0.3em; width: 80%; margin-left: auto; margin-right: auto; }
div.styled div.left { padding: 0 1em 0.5em 0; }
div.styled div.right { padding: 0 0 0.5em 1em; }
div.styled div.center { margin-bottom: 1.3em; }
</pre>
<p>このbase.cssは、</p>
<ul>
<li><b>RESET</b><br />トラブルになりにくい緩めのリセット</li>
<li><b>PREFERENCES</b><br />bodyタグなど基本的なエレメントの初期設定</li>
<li><b>REBUILD</b><br />&lt;div class=&#34;styled&#34;&gt;の中でだけ機能するpタグなどのスタイル集</li>
<li><b>CLASSES</b><br />投入者用の簡単なクラス集</li>
</ul>
<p>で構成されています。</p>
<p>商用非商用を問わず、ご自由にご利用ください<sup>[<a href="#note">※</a>]</sup>。</p>
<ol class="note" id="note">
<li>記事中の内容は2010年9月14日現在のものです</li>
<li>内容はアップデートされるため、直リンクはご遠慮ください</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/shared-base-css.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>画像が非表示の時は代わりにテキストを表示させる</title>
		<link>http://snippet-editor.com/2010/08/css-image-replacement.html</link>
		<comments>http://snippet-editor.com/2010/08/css-image-replacement.html#comments</comments>
		<pubDate>Sun, 29 Aug 2010 03:16:16 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS画像置換]]></category>
		<category><![CDATA[developer.css]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=463</guid>
		<description><![CDATA[画像化されたテキストは、閲覧者が画像を非表示にすると読むことができません。サイトのナビゲーションに画像を使用しているようなケースでは特に問題です。CSS画像置換のテクニックで対処しましょう。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
.replace { display: block; width: YOUR-IMAGE-WIDTHpx; height: YOUR-IMAGE-HEIGHTpx; overflow: hidden; position: relative; z-index: 1; }
.replace span.image { display: block; width: 100%; height: 100%; background: url(YOUR-IMAGE) no-repeat; position: absolute; left: 0; top: 0; z-index: 2; }
</pre>
<p><span id="more-463"></span></p>
<p>主にロゴやナビゲーションなど文字情報を画像化して使うようなシーンでは、ユーザーに画像を非表示にされてしまうことが致命的です。</p>
<p>これを解決するのがいわゆる「CSS画像置換」というやつで、様々なバリエーションがありますが、今回ご紹介するのは他のどれよりも汎用性が高いと思われます。</p>
<p>HTMLは以下のように記述します（ロゴの中のaタグに適応した例）。</p>
<pre class="brush: xml;">
&lt;h1 id=&quot;logo&quot;&gt;&lt;a href=&quot;/&quot; class=&quot;replace&quot;&gt;TEXT HERE&lt;span class=&quot;image&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;
</pre>
<p>仕組みは単純で、span.imageに設定した背景画像が「TEXT HERE」の上に覆い被さるようになっていますので、ユーザーが画像を非表示にすれば下のテキストが見えるようになっています。</p>
<p>一度クラス化してしまうと、個々の運用はもっと楽に。</p>
<pre class="brush: css;">
/* クラス化 */
.replace { display: block; overflow: hidden; position: relative; z-index: 1; }
.replace span.image { display: block; width: 100%; height: 100%; background-repeat: no-repeat; position: absolute; left: 0; top: 0; z-index: 2; }

/* 個々の記述 */
#logo a.replace { width: YOUR-IMAGE-WIDTHpx; height: YOUR-IMAGE-HEIGHTpx; }
#logo a.replace span.image { background-image: url(YOUR-IMAGE); }
</pre>
<p>これで、個々の記述は3点（幅・高さ・背景画像）だけと、普段使いがとても良くなりました。</p>
<h3>応用編</h3>
<p>spanタグを使って画像を指定している点に疑問を感じる方もいるかもしれません。</p>
<p>こうしておくとa:hoverで画像を切り替えることが出来るようになります。こちらもクラス化しておきましょう。</p>
<pre class="brush: css;">
a.replace:hover { cursor: pointer; background-color: transparent; }
a.replace:hover span.hover.image { background-position: left bottom; }
</pre>
<p class="note">（1行目の記述は、IEが言うこと聞かないので書いてあります）</p>
<p class="button"><a href="http://media.snippet-editor.com/2010/08/css-image-replacement.html"><span>動作確認はこちら</span></a></p>
<p>若干ですが欠点もありますので、説明してお終いにします。</p>
<ol class="note">
<li>透過している画像は使えません（下に隠したテキストが見えてしまうため）</li>
<li>適応した部分は必ずブロック要素化されますので、インライン要素としては使えません</li>
<li>隠しテキストの多用は、Googleからスパム判定を食らうリスクがあります</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/08/css-image-replacement.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>もうfont-familyで悩まないための2行</title>
		<link>http://snippet-editor.com/2010/08/definitive-font-family.html</link>
		<comments>http://snippet-editor.com/2010/08/definitive-font-family.html#comments</comments>
		<pubDate>Tue, 24 Aug 2010 01:43:06 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[base.css]]></category>
		<category><![CDATA[font-family]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=32</guid>
		<description><![CDATA[Macにはヒラギノフォント、Windowsにはメイリオといういいフォントが入っています。もしそれらのフォントで表示されないのだとしたら、コードを書いた人の責任です。]]></description>
			<content:encoded><![CDATA[<pre class="brush: css;">
body, textarea { font-family: &quot;メイリオ&quot;, &quot;ＭＳ Ｐゴシック&quot;, sans-serif; }
input, select { font-family: Arial, &quot;ＭＳ Ｐゴシック&quot;, sans-serif; }
</pre>
<p><span id="more-32"></span></p>
<p>この2行のスタイルシートで、Windowsではメイリオフォント（なければMS Pゴシック）、Macではヒラギノ角ゴシック（Firefoxのみ補足あり）で表示させることができます。</p>
<p>実際に適応すると、</p>
<ul>
<li>Windows 7またはWindows Vistaではメイリオで表示され</li>
<li>Windows XPではMS Pゴシックに</li>
<li>Windows XPで、且つメイリオを<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=f7d758d2-46ff-4c55-92f2-69ae834ac928&#038;DisplayLang=ja" target="_blank">自分でインストール</a>した人はメイリオに</li>
<li>Mac OS Xではヒラギノ角ゴに（Firefox以外のMac用ブラウザでは日本語で書かれた指定内容を無視するため、標準のゴシックに）</li>
</ul>
<p>と、なります。</p>
<p>なお例外として、</p>
<ul>
<li>MacにMS Office 2008がインストールされている状態では、Firefoxだけがメイリオで表示</li>
<li>MacにMS Office 2004がインストールされている状態では、FirefoxだけがMS Pゴシックで表示</li>
</ul>
<p>となりますが、いずれの場合もFirefoxの環境設定でチェックボックスひとつ変えるだけでヒラギノに戻すことができます。</p>
<p>もちろん、Firefox兼Office兼Macユーザーに負担を強いないために1行目を</p>
<pre class="brush: css;">
body, textarea { font-family: &quot;ヒラギノ角ゴ Pro W3&quot;, &quot;メイリオ&quot;, &quot;ＭＳ Ｐゴシック&quot;, sans-serif; }
</pre>
<p>のように記述することもできますが、この方法では別の問題を呼び起こしてしまうため、より影響範囲の狭いと思われる方をチョイスしてあります。</p>
<p>2行目については、メイリオがinputタグとselectタグには向いてないという理由で除外。Arialは他のフォントに変更しても大丈夫ですが、何らかの欧文フォントの指定は必要です（ここではMS Pゴシックとの相性を考えてArialにしてあります）。</p>
<p>検証は主要なモダンブラウザ（IE 6以降、Firefox 3以降、Safari 3以降、OperaとChromeは最新版）で行いました。</p>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/08/definitive-font-family.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

