<?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>Webクリエイターボックス &#187; CSS</title>
	<atom:link href="http://www.webcreatorbox.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webcreatorbox.com</link>
	<description>WebデザインやWebサイト制作、最新のWeb業界情報などを紹介していくサイト。</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:55:43 +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>CSS3とjQueryでフォームを美しく装飾する方法</title>
		<link>http://www.webcreatorbox.com/tech/css3-jquery-form/</link>
		<comments>http://www.webcreatorbox.com/tech/css3-jquery-form/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 02:00:38 +0000</pubDate>
		<dc:creator>Webクリエイターボックス</dc:creator>
				<category><![CDATA[Web制作テクニック]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.webcreatorbox.com/?p=2943</guid>
		<description><![CDATA[どんなWebサイトでも設置されているフォーム。なんの装飾もなく味気ないフォームより、デザインされたもののほうが連絡してみたくなるはずです！そんなフォームも少し手を加えるだけで素敵なデザインに変身させることができます。今回 [...]]]></description>
			<content:encoded><![CDATA[<p>どんなWebサイトでも設置されているフォーム。なんの装飾もなく味気ないフォームより、デザインされたもののほうが連絡してみたくなるはずです！そんなフォームも少し手を加えるだけで素敵なデザインに変身させることができます。今回はCSS3とjQueryを使ってより美しいフォームを作成する方法を紹介します。</p>
<p><span id="more-2943"></span><br />
<a href="http://www.green-japan.com/" target="_blank" onClick="_gaq.push(['_trackEvent', 'Ads', 'click', 'A']);"><img class="ad_468x60" border="0" width="468" height="60" alt="IT系、Web業界の求人に強い転職サイト【green】" src="http://webcreatorbox.com/wp-content/themes/wcb2/images/ads/green-banner.jpg"></a></p>
<h2 class="post_h2">フォームの仕様</h2>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form.jpg" alt="CSS3+jQueryでフォームを装飾" title="CSS3+jQuery" width="500" height="270" class="alignnone size-full wp-image-2958" /></p>
<p>今回チャレンジするフォームの主な仕様です！</p>
<ul class="post_ul">
<li>グラデーション・ボックスシャドウを使って立体感を表現</li>
<li>角丸で丸みをつける（モダンブラウザ）</li>
<li>対応ブラウザ: IE7△, IE8△, IE9, Firefox, Chrome, Safari</li>
</ul>
<p><a href="/sample-css3-jquery-form" class="btn_sample" target="_blank">サンプル</a></p>
<h2 class="post_h2"><a name="form">フォーム制作の流れ</a></h2>
<p>CSS3ってなんだ？という人もひとつひとつ記述していけば意外と簡単に作れるはずです！リンクをクリックで各項目にジャンプします。</p>
<ol class="post_ol">
<li><a href="#form1">テキストボックス、セレクトメニュー、テキストエリアの装飾</a></li>
<li><a href="#form2">送信ボタンの装飾</a></li>
<li><a href="#form3">チェックボックス、ラジオボタンの装飾</a></li>
<li><a href="#form4">完成！</a></li>
</ol>
<h2 class="post_h2"><a name="form1">1. テキストボックス、セレクトメニュー、テキストエリアの装飾</a></h2>
<p>テキストボックス、セレクトメニュー、テキストエリアには同じ効果を実装させます。</p>
<h3 class="post_h3">1-1. まずは部品設置とベースの装飾</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form1-1.gif" alt="フォームの部品を設置" title="フォームの部品を設置" width="453" height="358" class="alignnone size-full wp-image-2959" /></p>
<p><code>&lt;form&gt;</code>内にテキストボックス、セレクトメニュー、テキストエリアを設置し、背景色などの基本的な装飾を実装します。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;form&gt;
    &lt;div&gt;
        &lt;label&gt;名前&lt;/label&gt;&lt;br /&gt;
        &lt;input type=&quot;text&quot; class=&quot;text&quot; size=&quot;35&quot; value=&quot;&quot; /&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;label&gt;メールアドレス&lt;/label&gt;&lt;br /&gt;
        &lt;input type=&quot;text&quot; class=&quot;text&quot; size=&quot;35&quot; value=&quot;&quot; /&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;label&gt;セレクトメニュー&lt;/label&gt;&lt;br /&gt;
        &lt;select class=&quot;dropdown&quot;&gt;
            &lt;option&gt;選択してください&lt;/option&gt;
            &lt;option&gt;嬉しい&lt;/option&gt;
            &lt;option&gt;楽しい&lt;/option&gt;
            &lt;option&gt;大好き&lt;/option&gt;
        &lt;/select&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;label&gt;コメント&lt;/label&gt;&lt;br /&gt;
	&lt;textarea cols=&quot;35&quot; rows=&quot;7&quot; name=&quot;comments&quot; id=&quot;comments&quot;&gt;&lt;/textarea&gt;
    &lt;/div&gt;
&lt;/form&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
form{background: #eee;width:400px;}
	form div{padding: 10px 20px;}
</pre>
<h3 class="post_h3">1-2. グラデーション</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form1-2.gif" alt="CSS3でグラデーション" title="グラデーション" width="500" height="390" class="alignnone size-full wp-image-2960" /></p>
<p>それぞれにCSS3でグラデーションをつけます。各ブラウザーによって書き方が違うのでややこしいのですが、下記コードをコピペしてご使用ください :)</p>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
.text, textarea, .dropdown{
	border:1px solid #777;
	padding: 5px;
	color: #999;
	background: #fff;

/* Webkit */
	background: -webkit-gradient(
		linear,
		left top,
		left bottom,
		from(#eee),
		to(#fff)
		);

/* Firefox */
	background: -moz-linear-gradient(
		top,
		#eee,
		#fff
		);

/* IE */
	filter:progid:DXImageTransform.Microsoft.gradient
        (startColorstr=#ffeeeeee,endColorstr=#ffffffff);
	zoom: 1;
}
</pre>
<h3 class="post_h3">1-3. 角丸</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form1-3.gif" alt="CSS3で角丸" title="CSS3で角丸" width="500" height="390" class="alignnone size-full wp-image-2961" /></p>
<p>コーナー部分に丸みをもたせて柔らかい印象に！※Chrome, Safari, Firefox対応</p>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; highlight: [6,16,24]; title: ; notranslate">
.text, textarea, .dropdown{
	border:1px solid #777;
	padding: 5px;
	color: #999;
	background: #fff;
	border-radius: 5px;

	/* Webkit */
	background: -webkit-gradient(
		linear,
		left top,
		left bottom,
		from(#eee),
		to(#fff)
		);
	-webkit-border-radius: 5px;

	/* Firefox */
	background: -moz-linear-gradient(
		top,
		#eee,
		#fff
		);
	-moz-border-radius: 5px;

	/* IE */
	filter:progid:DXImageTransform.Microsoft.gradient
        (startColorstr=#ffeeeeee,endColorstr=#ffffffff);
	zoom: 1;
}
</pre>
<h3 class="post_h3">1-4. ボックスシャドウ</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form1-4.gif" alt="CSS3でボックスシャドウ" title="CSS3でボックスシャドウ" width="500" height="390" class="alignnone size-full wp-image-2962" /></p>
<p>背景色をつけている場合、ボックスシャドウをプラスすることでより立体的に表現できます。</p>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; highlight: [18,28]; title: ; notranslate">
.text, textarea, .dropdown{
	border:1px solid #777;
	padding: 5px;
	color: #999;
	background: #fff;
	border-radius: 5px;

	/* Webkit */
	background: -webkit-gradient(
		linear,
		left top,
		left bottom,
		from(#eee),
		to(#fff)
		);

	-webkit-border-radius: 5px;
	-webkit-box-shadow: 1px 1px 1px #fff;

	/* Firefox */
	background: -moz-linear-gradient(
		top,
		#eee,
		#fff
		);

	-moz-border-radius: 5px;
	-moz-box-shadow: 1px 1px 1px #fff;

	/* IE */
	filter:progid:DXImageTransform.Microsoft.gradient
        (startColorstr=#ffeeeeee,endColorstr=#ffffffff);
	zoom: 1;
}
</pre>
<p>&raquo; <a href="/sample-css3-jquery-form">サンプルを見る</a></p>
<p><a class="back_top" href="#form">フォーム制作の流れ 目次へ。</a></p>
<h2 class="post_h2"><a name="form2">2. 送信ボタンの装飾</a></h2>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form2.gif" alt="送信ボタンの装飾" title="送信ボタンの装飾" width="500" height="434" class="alignnone size-full wp-image-2963" /></p>
<p>送信ボタンも 1. と同じくグラデーション、角丸、ボックスシャドウの効果を付け加えます。色はお好みで変更してください！</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;div&gt;
    &lt;input type=&quot;submit&quot; class=&quot;submit&quot; value=&quot;送信する&quot; /&gt;
&lt;/div&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
.submit{
	border:1px solid #777;
	padding: 4px 10px;
	color: #fff;
	cursor: pointer;
	background: #428ec9;
	border-radius: 5px;

/* Webkit */
	background: -webkit-gradient(
		linear,
		left top,
		left bottom,
		from(#99c9e5),
		to(#428ec9)
		);
	-webkit-border-radius: 5px;
	-webkit-box-shadow: 1px 1px 1px #fff;

/* Firefox */
	background: -moz-linear-gradient(
		top,
		#99c9e5,
		#428ec9
		);
	-moz-border-radius: 5px;
	-moz-box-shadow: 1px 1px 1px #fff;

/* IE */
	filter:progid:DXImageTransform.Microsoft.gradient
        (startColorstr=#ff99c9e5,endColorstr=#ff428ec9);
	zoom: 1;
}
</pre>
<p>&raquo; <a href="/sample-css3-jquery-form">サンプルを見る</a></p>
<p><a class="back_top" href="#form">フォーム制作の流れ 目次へ。</a></p>
<h2 class="post_h2"><a name="form3">3. チェックボックス、ラジオボタンの装飾</a></h2>
<p>CSSでは装飾できないチェックボックスとラジオボタンには画像とjQueryを使ってデザインします。</p>
<h3 class="post_h3">3-1. 画像をつくる</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form3-1.gif" alt="CSSスプライト画像" title="CSSスプライト画像" width="428" height="195" class="alignnone size-full wp-image-2964" /></p>
<p>チェック前、チェック後ともにひとつの画像を使用します。チェック前は上部分のみ表示し、チェック後に下部分を表示する仕組みです。（CSSスプライトについては→<a href="http://www.webcreatorbox.com/tech/css-sprite/">CSSスプライトで画像を円滑に表示させる</a>）</p>
<h3 class="post_h3">3-2. チェックボックス、ラジオボタンを画像に置換</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form3-2-450x500.gif" alt="チェックボックス、ラジオボタンを画像に置換" title="チェックボックス、ラジオボタンを画像に置換" width="450" height="500" class="alignnone size-medium wp-image-2965" /></p>
<p>チェックボックスとラジオボタンに <code>z-index: -1; position: absolute;</code> を加えて画像に置換します。図のようにチェックボックスとラジオボタンの上に画像を重ねているわけです。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- チェックボックス --&gt;
&lt;div&gt;
	&lt;input id=&quot;CheckBox1&quot; type=&quot;checkbox&quot; class=&quot;checkbox&quot;/&gt;
	&lt;label id=&quot;Label1&quot; for=&quot;CheckBox1&quot; class=&quot;CheckBoxLabelClass&quot;&gt;Checkbox 1&lt;/label&gt;

	&lt;input id=&quot;CheckBox2&quot; type=&quot;checkbox&quot; class=&quot;checkbox&quot;/&gt;
	&lt;label id=&quot;Label2&quot; for=&quot;CheckBox2&quot; class=&quot;CheckBoxLabelClass&quot;&gt;Checkbox 2&lt;/label&gt;
&lt;/div&gt;

&lt;!-- ラジオボタン --&gt;
&lt;div&gt;
	&lt;input id=&quot;Radio1&quot; type=&quot;radio&quot; class=&quot;radio&quot; name=&quot;group1&quot; &gt;
	&lt;label id=&quot;Label1&quot; for=&quot;Radio1&quot; class=&quot;radiolabel&quot;&gt;Radio 1&lt;/label&gt;
	&lt;input id=&quot;Radio2&quot; type=&quot;radio&quot; class=&quot;radio&quot; name=&quot;group1&quot;/&gt;

	&lt;label id=&quot;Label2&quot; for=&quot;Radio2&quot; class=&quot;radiolabel&quot;&gt;Radio 2&lt;/label&gt;
	&lt;input id=&quot;Radio3&quot; type=&quot;radio&quot; class=&quot;radio&quot; name=&quot;group1&quot;/&gt;
	&lt;label id=&quot;Label3&quot; for=&quot;Radio3&quot; class=&quot;radiolabel&quot;&gt;Radio 3&lt;/label&gt;
&lt;/div&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
.checkbox,.radio{
	z-index: -1;
	position: absolute;
	}
	.CheckBoxLabelClass{
		background: url(&quot;http://www.webcreatorbox.com/sample/images/checkbox.png&quot;) no-repeat top left;
		margin-right:20px;
		padding-left:22px;
		}

	.radiolabel{
		background: url(&quot;http://www.webcreatorbox.com/sample/images/radio.png&quot;) no-repeat top left;
		margin-right:20px;
		padding-left:22px;
		}
</pre>
<h3 class="post_h3">3-3. jQueryでクラスを与える</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form3-3.gif" alt=" jQueryでクラスを与える" title=" jQueryでクラスを与える" width="478" height="188" class="alignnone size-full wp-image-2966" /></p>
<p>チェックされた時にjQueryを使ってクラスを与えます。チェックされた時の画像を表示させるためです。<a href="http://jquery.com/">jQueryファイル</a>をダウンロードして <code>&lt;head&gt;</code> 内に記述しましょう。</p>
<h4 class="post_h4">header内でjQueryファイルを読み込む</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.js&quot;&gt;&lt;/script&gt;
</pre>
<h4 class="post_h4">jQueryコード</h4>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){
	$(&quot;.checkbox&quot;).change(function(){
		if($(this).is(&quot;:checked&quot;)){
			$(this).next(&quot;label&quot;).addClass(&quot;LabelSelected&quot;);
		}else{
			$(this).next(&quot;label&quot;).removeClass(&quot;LabelSelected&quot;);
		}
	});
	$(&quot;.radio&quot;).change(function(){
		if($(this).is(&quot;:checked&quot;)){
			$(&quot;.RadioSelected:not(:checked)&quot;).removeClass(&quot;RadioSelected&quot;);
			$(this).next(&quot;label&quot;).addClass(&quot;RadioSelected&quot;);
		}
	});
});
&lt;/script&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
.LabelSelected,.RadioSelected{
	background-position: bottom left;
	}
</pre>
<p>&raquo; <a href="/sample-css3-jquery-form">サンプルを見る</a></p>
<p><a class="back_top" href="#form">フォーム制作の流れ 目次へ。</a></p>
<h2 class="post_h2"><a name="form4">4. 完成！</a></h2>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/form4.gif" alt="フォーム完成" title="フォーム完成" width="500" height="413" class="alignnone size-full wp-image-2967" /></p>
<p>素敵に変身をとげました！コードをまとめるとこんな感じです↓</p>
<h4 class="post_h4">HTML（header内）</h4>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){
	$(&quot;.checkbox&quot;).change(function(){
		if($(this).is(&quot;:checked&quot;)){
			$(this).next(&quot;label&quot;).addClass(&quot;LabelSelected&quot;);
		}else{
			$(this).next(&quot;label&quot;).removeClass(&quot;LabelSelected&quot;);
		}
	});
	$(&quot;.radio&quot;).change(function(){
		if($(this).is(&quot;:checked&quot;)){
			$(&quot;.RadioSelected:not(:checked)&quot;).removeClass(&quot;RadioSelected&quot;);
			$(this).next(&quot;label&quot;).addClass(&quot;RadioSelected&quot;);
		}
	});
});
&lt;/script&gt;
</pre>
<h4 class="post_h4">HTML（body内）</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;form&gt;
    &lt;div&gt;
        &lt;label&gt;名前&lt;/label&gt;&lt;br /&gt;
        &lt;input type=&quot;text&quot; class=&quot;text&quot; size=&quot;35&quot; value=&quot;&quot; /&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;label&gt;メールアドレス&lt;/label&gt;&lt;br /&gt;
        &lt;input type=&quot;text&quot; class=&quot;text&quot; size=&quot;35&quot; value=&quot;&quot; /&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;label&gt;セレクトメニュー&lt;/label&gt;&lt;br /&gt;
        &lt;select class=&quot;dropdown&quot;&gt;
            &lt;option&gt;選択してください&lt;/option&gt;
            &lt;option&gt;嬉しい&lt;/option&gt;
            &lt;option&gt;楽しい&lt;/option&gt;
            &lt;option&gt;大好き&lt;/option&gt;
        &lt;/select&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;input id=&quot;CheckBox1&quot; type=&quot;checkbox&quot; class=&quot;checkbox&quot;/&gt;
        &lt;label id=&quot;Label1&quot; for=&quot;CheckBox1&quot; class=&quot;CheckBoxLabelClass&quot;&gt;Checkbox 1&lt;/label&gt;

        &lt;input id=&quot;CheckBox2&quot; type=&quot;checkbox&quot; class=&quot;checkbox&quot;/&gt;
        &lt;label id=&quot;Label2&quot; for=&quot;CheckBox2&quot; class=&quot;CheckBoxLabelClass&quot;&gt;Checkbox 2&lt;/label&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;input id=&quot;Radio1&quot; type=&quot;radio&quot; class=&quot;radio&quot; name=&quot;group1&quot; &gt;
        &lt;label id=&quot;Label1&quot; for=&quot;Radio1&quot; class=&quot;radiolabel&quot;&gt;Radio 1&lt;/label&gt;

        &lt;input id=&quot;Radio2&quot; type=&quot;radio&quot; class=&quot;radio&quot; name=&quot;group1&quot;/&gt;
        &lt;label id=&quot;Label2&quot; for=&quot;Radio2&quot; class=&quot;radiolabel&quot;&gt;Radio 2&lt;/label&gt;	

        &lt;input id=&quot;Radio3&quot; type=&quot;radio&quot; class=&quot;radio&quot; name=&quot;group1&quot;/&gt;
        &lt;label id=&quot;Label3&quot; for=&quot;Radio3&quot; class=&quot;radiolabel&quot;&gt;Radio 3&lt;/label&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;label&gt;コメント&lt;/label&gt;&lt;br /&gt;
        &lt;textarea cols=&quot;35&quot; rows=&quot;7&quot; name=&quot;comments&quot; id=&quot;comments&quot;&gt;&lt;/textarea&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;input type=&quot;submit&quot; class=&quot;submit&quot; value=&quot;送信する&quot; /&gt;
    &lt;/div&gt;
&lt;/form&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
form{background: #ddd;width:400px;}
	form div{padding: 10px 20px;}

.text, textarea, .dropdown{
	border:1px solid #777;
	padding: 5px;
	color: #999;
	background: #fff;
	border-radius: 5px;

	/* Webkit */
	background: -webkit-gradient(
		linear,
		left top,
		left bottom,
		from(#eee),
		to(#fff)
		);

	-webkit-border-radius: 5px;
	-webkit-box-shadow: 1px 1px 1px #fff;

	/* Firefox */
	background: -moz-linear-gradient(
		top,
		#eee,
		#fff
		);

	-moz-border-radius: 5px;
	-moz-box-shadow: 1px 1px 1px #fff;

	/* IE */
	filter:progid:DXImageTransform.Microsoft.gradient
        (startColorstr=#ffeeeeee,endColorstr=#ffffffff);
	zoom: 1;
	}

.submit{
	border:1px solid #777;
	padding: 4px 10px;
	color: #fff;
	cursor: pointer;
	background: #428ec9;
	border-radius: 5px;

	/* Webkit */
	background: -webkit-gradient(
		linear,
		left top,
		left bottom,
		from(#99c9e5),
		to(#428ec9)
		);
	-webkit-border-radius: 5px;
	-webkit-box-shadow: 1px 1px 1px #fff;

	/* Firefox */
	background: -moz-linear-gradient(
		top,
		#99c9e5,
		#428ec9
		);
	-moz-border-radius: 5px;
	-moz-box-shadow: 1px 1px 1px #fff;

	/* IE */
	filter:progid:DXImageTransform.Microsoft.gradient
        (startColorstr=#ff99c9e5,endColorstr=#ff428ec9);
	zoom: 1;
	}

.checkbox,.radio{
	z-index: -1;
	position: absolute;
	}
	.CheckBoxLabelClass{
		background: url(&quot;http://www.webcreatorbox.com/sample/images/checkbox.png&quot;) no-repeat top left;
		margin-right:20px;
		padding-left:22px;
		}

	.radiolabel{
		background: url(&quot;http://www.webcreatorbox.com/sample/images/radio.png&quot;) no-repeat top left;
		margin-right:20px;
		padding-left:22px;
		}
	.LabelSelected,.RadioSelected{
		background-position: bottom left;
		}
</pre>
<p>「えー、もっと楽な方法あるよ？」というのがあればぜひぜひ教えてください！</p>
<p>&raquo; <a href="/sample-css3-jquery-form">サンプルを見る</a></p>
<p><a class="back_top" href="#form">フォーム制作の流れ 目次へ。</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webcreatorbox.com/tech/css3-jquery-form/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Webサイトの基本要素 見出し・リスト・引用文のスタイルを整える</title>
		<link>http://www.webcreatorbox.com/tech/css-heading-list-blockquote/</link>
		<comments>http://www.webcreatorbox.com/tech/css-heading-list-blockquote/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 02:01:15 +0000</pubDate>
		<dc:creator>Webクリエイターボックス</dc:creator>
				<category><![CDATA[Web制作テクニック]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.webcreatorbox.com/?p=2758</guid>
		<description><![CDATA[Webサイトを装飾していく時に無視できない要素、見出し・リスト・引用文。特にWordPressでオリジナルのテーマを作る時は、ブログ用にこれら基本の要素すべての装飾もすると思います。そんな時に使うコードのバリエーションを [...]]]></description>
			<content:encoded><![CDATA[<p>Webサイトを装飾していく時に無視できない要素、見出し・リスト・引用文。特にWordPressでオリジナルのテーマを作る時は、ブログ用にこれら基本の要素すべての装飾もすると思います。そんな時に使うコードのバリエーションをメモしていたので記事にしました。少し変えるだけで応用できると思うので、ぜひ使ってみてください！</p>
<p><span id="more-2758"></span><br />
<a href="http://www.green-japan.com/" target="_blank" onClick="_gaq.push(['_trackEvent', 'Ads', 'click', 'A']);"><img class="ad_468x60" border="0" width="468" height="60" alt="IT系、Web業界の求人に強い転職サイト【green】" src="http://webcreatorbox.com/wp-content/themes/wcb2/images/ads/green-banner.jpg"></a></p>
<p>色、フォント、サイズなどを変えるだけで、どんなサイトでも使える見出し・リスト・引用文用のHTMLとCSSコードを紹介します。そのままコピペして使っちゃってください。少しはコーディングの手間が省ける…かもしれません。ちょいちょい使っている画像も保存して使ってもらってもOKです :)</p>
<p></p>
<p>サンプルはこちら。IE6, 7, 8, FF, Chrome, Safariで動作確認済。</p>
<p><a href="/sample-headings-list-blockquote/" class="btn_sample" target="_blank">サンプル</a><br />
</p>
<h2 class="post_h2">見出しの装飾</h2>
<h3 class="post_h3">斜線を使った見出し</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample1.gif" alt="見出しのデザイン" title="斜線を使った見出し" width="500" height="162" class="alignnone size-full wp-image-2789" /></a></p>
<p>まずは基本。背景画像を使って見出しの下部に斜線を表示させます。斜線だけでなく、線種を変えていろんなデザインに応用できます。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;h2 id=&quot;heading1&quot;&gt;デザインサンプル&lt;/h2&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#heading1{
	background: url(images/line.gif) repeat-x bottom left;
	padding-bottom: 15px;
	color: #3cf;
	}
</pre>
<h3 class="post_h3">グラデーションを使った見出し</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample2.gif" alt="見出しのデザイン" title="グラデーションを使った見出し" width="500" height="179" class="alignnone size-full wp-image-2790" /></a></p>
<p>CSS3を使ってグラデーションを！IE6～8にも対応させるため、<a href="http://css3pie.com/">CSS3 PIE</a>を利用します。まずは<a href="http://css3pie.com/">CSS3 PIE</a>をダウンロード。<strong>PIE.htc</strong>ファイルをアップロードし、<code>behavior: url(PIE.htc);</code> と <code>-pie-background:linear-gradient(グラデーションの位置と色);</code> を記述すればOK。「<a href="http://coliss.com/articles/build-websites/operation/css/css3pie-decorations-for-ie.html">たった一行を追加するだけでIE6/7/8をCSS3対応にする -CSS3 PIE</a>」で詳しく説明されています。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;h2 id=&quot;heading2&quot;&gt;デザインサンプル&lt;/h2&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#heading2{
	background: #fff;
	border-top:1px solid #ddd;
	border-right:1px solid #ddd;
	border-bottom:1px solid #ddd;
	border-left:3px solid #3cf;
	padding: 5px 0 5px 10px;
    background: -moz-linear-gradient(top, #fff 0%, #eee 50%, #ddd 51%, #fff 100%); /* firefox */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fff), color-stop(50%,#eee), color-stop(51%,#ddd), color-stop(100%,#fff)); /* webkit */
    -pie-background:linear-gradient(top, #fff 0%, #eee 50%, #ddd 51%, #fff 100%); /* ie */
    behavior: url(images/PIE.htc);  /* ie */
}
</pre>
<h3 class="post_h3">グラデーションと角丸を使った見出し</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample3.gif" alt="グラデーションと角丸の見出し" title="グラデーションと角丸" width="500" height="169" class="alignnone size-full wp-image-2792" /></a></p>
<p>こちらもCSS3を使います。上記と同様、CSS3 PIEをIE用に利用。見出しだけでなくボタンなどにも使えますね！</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;h2 id=&quot;heading3&quot;&gt;&lt;span&gt;デザインサンプル&lt;/span&gt;&lt;/h2&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#heading3{
    border:solid 1px #ddd;
    padding: 5px;
    border-radius: 5px;
    background: #eee;
    -moz-border-radius: 5px; /* FF */
    background: -moz-linear-gradient(top,  #fff,  #eee); /* FF */
    -webkit-border-radius: 5px;/* Webkit */
    background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));/* Webkit */
    -pie-background:linear-gradient(top,  #fff,  #eee); /* ie */
    behavior: url(images/PIE.htc);  /* ie */
    }
    #heading3 span{border-left:5px #3cf solid;padding-left:10px;}
</pre>
<h3 class="post_h3">英語も一諸に表示した見出し</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample4.gif" alt="英語と日本語を使った見出しデザイン" title="英語と日本語の見出し" width="500" height="158" class="alignnone size-full wp-image-2793" /></a></p>
<p>時々見かける日本語＋英語の見出し。画像を使っているサイトが多いのですが、テキストでももちろん実装可能です！</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;h2 id=&quot;heading4&quot;&gt;デザインサンプル&lt;span&gt;Design Sample&lt;/span&gt;&lt;/h2&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#heading4{
	border-bottom: 5px #3cf solid;
	padding-bottom: 5px;
	}
	#heading4 span{
		margin-left:20px;
		font-size:60%;
		color: #ccc;
		position: relative;
		top: -5px;
		}
</pre>
<h2 class="post_h2">リストの装飾</h2>
<h3 class="post_h3">数字のリスト</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample5.gif" alt="CSSデザイン" title="数字のリストデザイン" width="500" height="231" class="alignnone size-full wp-image-2794" /></a></p>
<p>数字の部分もフォントや色を変えたらとっても素敵なデザインに！ここでは最近マイブームな<a href="http://code.google.com/webfonts">Google Font API</a>を利用。ここのサイトに登録してあるフォントを無料でWebフォントとして使うことができます。IE6〜対応。英語しか登録されていないので、日本語サイトではこのように「部分的に」しか使えないと思いますが…。詳しい使い方は「<a href="http://blog.e-riverstyle.com/2010/05/google-font-api.html">Google Font APIを試してみた。</a>」を覗いてみてください。原理としては、<code>ol</code> でフォントや色を変えて、<code>span</code> で元に戻す感じです。</p>
<h4 class="post_h4">header内に追加</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;link href='http://fonts.googleapis.com/css?family=Neucha&amp;subset=latin' rel='stylesheet' type='text/css'&gt;
</pre>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;ol id=&quot;ol1&quot;&gt;
	&lt;li&gt;&lt;span&gt;リストの装飾です&lt;/span&gt;&lt;/li&gt;
	&lt;li&gt;&lt;span&gt;Neuchaというフォントを使っています&lt;/span&gt;&lt;/li&gt;
	&lt;li&gt;&lt;span&gt;色も変えるとなんだか新鮮！&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#ol1 li{
	color: #3cf;
	font-size:200%;
	font-family: 'Neucha';
	list-style: decimal inside;
	}
	#ol1 li span{
		color: #666;
		font-size:14px;
		font-family:'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro',Osaka,'ＭＳ Ｐゴシック',sans-serif;
		}
</pre>
<h3 class="post_h3">点の部分だけ色を変える</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample6.gif" alt="CSS　リストの装飾" title="点だけ色を変える" width="500" height="120" class="alignnone size-full wp-image-2795" /></a></p>
<p>お手軽に装飾できるこの技。技というほどでもないかもしれませんが、さっと使えて便利です。先ほどと同じく<code>ul</code> に色をつけて、 <code>span</code> で元に戻します。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;ul id=&quot;ul1&quot;&gt;
	&lt;li&gt;&lt;span&gt;リストの装飾です&lt;/span&gt;&lt;/li&gt;
	&lt;li&gt;&lt;span&gt;点の部分だけ色を変えて&lt;/span&gt;&lt;/li&gt;
	&lt;li&gt;&lt;span&gt;ちょこーっと変化をつけましょう&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#ul1 li{list-style: square outside; color:#3cf;list-style-image:none;}
	#ul1 li span{color:#666;}
</pre>
<h3 class="post_h3">画像を使う</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample7.gif" alt="CSSでリスト装飾" title="画像でリストを装飾" width="500" height="117" class="alignnone size-full wp-image-2796" /></a></p>
<p>王道ですね。サイトにあった色・マークを選択してください！</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;ul id=&quot;ul2&quot;&gt;
	&lt;li&gt;リストの装飾です&lt;/li&gt;
	&lt;li&gt;とっても無難なやり方ですが&lt;/li&gt;
	&lt;li&gt;画像を使って装飾します&lt;/li&gt;
&lt;/ul&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#ul2 li{list-style-image: url(images/arrow.png);}
</pre>
<h3 class="post_h3">グラデーションを使う</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample8.gif" alt="CSSでグラデーションを使ったリストを実装" title="グラデーションを使ったリスト" width="500" height="148" class="alignnone size-full wp-image-2797" /></a></p>
<p>再び登場、CSS3＋CSS3 PIE。グラデーションと1pxのラインを使う事で立体感が出せます。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;ul id=&quot;ul3&quot;&gt;
	&lt;li&gt;リストの装飾です&lt;/li&gt;
	&lt;li&gt;グラデーションと1pxのラインで&lt;/li&gt;
	&lt;li&gt;立体感がでますね！&lt;/li&gt;
&lt;/ul&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">

#ul3{
	border: 1px solid #ccc;padding: 0;
	border-bottom: 0 none;
	width: 300px;
	}
#ul3 li{
	background: #eee;
        list-style-image:none;
	padding: 5px;
	border-bottom: 1px #ccc solid;
	border-top: 1px #fff solid;
    list-style: inside square;
	margin:0;
	background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));/* webkit */
	background: -moz-linear-gradient(top,  #eee,  #ddd);/* ff */
    -pie-background:linear-gradient(top,  #eee,  #ddd);/* ie */
    behavior: url(images/PIE.htc);  /* ie */
	}
</pre>
<h2 class="post_h2">引用文の装飾</h2>
<h3 class="post_h3">背景色とボーダー</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample9.gif" alt="背景色とボーダーで引用文を装飾" title="背景色とボーダーで装飾" width="500" height="134" class="alignnone size-full wp-image-2798" /></a></p>
<p>とっても無難な装飾。でもあるのとないのでは見た目が全然違いますね！</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;blockquote id=&quot;bq1&quot;&gt;
引用部分のデザイン。とってもベーシックですが、背景色とボーダーを加えてみました。こんな感じでいかがでしょう？
&lt;/blockquote&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#bq1{
	border-left:5px solid #ddd;
	background: #eee;
	padding: 10px;
	}
</pre>
<h3 class="post_h3">大きなクォーテーション背景画像</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample10.gif" alt="クォーテーション画像を使って装飾" title="大きめクォーテーションマークの画像" width="500" height="143" class="alignnone size-full wp-image-2799" /></a></p>
<p>インパクトあります。クライアントや読者からの感想を表示する時にアクセントとなっていいかも。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;blockquote id=&quot;bq2&quot;&gt;
引用部分のデザイン。Webクリエイターボックスのコメントエリアでも使用中の、大きなクオートを背景画像として用いたデザインです。長めの引用文でないと画像が途中で切れちゃいます。背景の画像には薄い色を使ってくださいね！
&lt;/blockquote&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#bq2{
	background: #eee url(images/quote.gif) no-repeat 5px 5px;
	padding: 15px;
	}
</pre>
<h3 class="post_h3">最初と最後にクォーテーションの画像</h3>
<p><a href="/sample-headings-list-blockquote/"><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/10/sample11.gif" alt="クォーテーション画像で引用文を装飾" title="最初と最後にクォーテーション" width="500" height="149" class="alignnone size-full wp-image-2800" /></a></p>
<p>ちょんちょんっとつけるだけで雰囲気が全然違いますね。<code>blockquote</code> に最初の画像、中の <code>span</code> タグに閉じ画像をプラス。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;blockquote id=&quot;bq3&quot;&gt;
&lt;span&gt;
引用部分のデザイン。最初と最後にクォーテーションの画像を使いました。ちょこんとかわいらしく、ポイントになっていいのでは？
&lt;/span&gt;
&lt;/blockquote&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
#bq3{
	background: #cbf5ff url(images/quote_open.gif) no-repeat top left;
	padding: 10px;
	text-indent: 15px;
	}
	#bq3 span{
	background: url(images/quote_close.gif) no-repeat bottom right;
	display: block;
	}
</pre>
<p>これらの色やサイズ、フォントなどをちょっと変えるだけで簡単に使用できると思います。<a href="/sample-headings-list-blockquote/">サンプル</a>も合わせてみてみてくださいね！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webcreatorbox.com/tech/css-heading-list-blockquote/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>少しのコードで実装可能な20のCSS小技集</title>
		<link>http://www.webcreatorbox.com/tech/css-tips20/</link>
		<comments>http://www.webcreatorbox.com/tech/css-tips20/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 02:40:56 +0000</pubDate>
		<dc:creator>Webクリエイターボックス</dc:creator>
				<category><![CDATA[Web制作テクニック]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.webcreatorbox.com/?p=1095</guid>
		<description><![CDATA[CSSハックに続き、このCSS小技集も私のブックマークにずらりと並んでいたので、整理も兼ねて記事にしてみました。CSSのお勉強を始めたばかりの頃にブックマークしておいたものも多数。。ということで初心者さんからベテランさん [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/tech/css-hack-list/" target="_blank">CSSハック</a>に続き、このCSS小技集も私のブックマークにずらりと並んでいたので、整理も兼ねて記事にしてみました。CSSのお勉強を始めたばかりの頃にブックマークしておいたものも多数。。ということで初心者さんからベテランさんまで参考にしてみてください！</p>
<p><span id="more-1095"></span><br />
<a href="http://www.green-japan.com/" target="_blank" onClick="_gaq.push(['_trackEvent', 'Ads', 'click', 'A']);"><img class="ad_468x60" border="0" width="468" height="60" alt="IT系、Web業界の求人に強い転職サイト【green】" src="http://webcreatorbox.com/wp-content/themes/wcb2/images/ads/green-banner.jpg"></a></p>
<p><a href="/sample-css-tips20" class="btn_sample" target="_blank">サンプル</a></p>
<h2 class="post_h2">まずはCSS基礎編</h2>
<h3 class="post_h3">1. divを中央揃えにする</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo1.gif" alt="CSS: divを中央揃えにする" title="divを中央揃えにする" width="500" height="270" class="alignnone size-full wp-image-1112" /></p>
<p>ほとんどのサイトが基準となるdivを画面の中央揃えに設定しています。左右のmarginをautoにして中央揃えに。</p>
<p><a href="/sample-css-tips20#demo1" class="btn_sample" target="_blank">サンプル</a></p>
<pre class="brush: css; title: ; notranslate">
#wrapper{ width: 950px; margin: 0 auto; }
</pre>
<h3 class="post_h3">2. divを横並びに</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo2.gif" alt="CSS: divを横並びに" title=" divを横並びに" width="500" height="270" class="alignnone size-full wp-image-1113" /></p>
<p>floatでdivを並べてレイアウトを組んでいきます。floatを解除する場合は<code>clear:both;</code>を使います。</p>
<p><a href="/sample-css-tips20#demo2" class="btn_sample" target="_blank">サンプル</a></p>
<pre class="brush: css; title: ; notranslate">
#main{ float: left; }
#side{ float: left; }
#footer{ clear: both; }
</pre>
<h3 class="post_h3">3. 複数のクラスを指定</h3>
<p>実はクラスは一度に複数指定できます。スペースを空けるだけなので簡単ですね。</p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;p class=&quot;border float bg&quot;&gt;いろんなクラスが！&lt;/p&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
.border{ border: 1px solid #000; }
.float{ float: left; }
.bg{ background-color: #eee; }
</pre>
<h3 class="post_h3">4. マージンやパディングのプロパティを短く指定</h3>
<p>マージンやパディングを指定する際、いちいち<code>margin-top:10px;</code>、<code>margin-left: 20px;</code>、、、と書かなくても一行で指定することができます。<code>margin: 上、右、下、左;</code>と、上から時計回りの順で指定していきます。</p>
<pre class="brush: css; title: ; notranslate">
#main{ margin: 10px 20px 30px 40px; }

/* 上下が同じ、左右が同じ幅 （margin: 上下 左右;）*/
#main{ margin: 10px 20px; }

/* 左右が同じ幅 （margin: 上 左右 下;）*/
#main{ margin: 10px 20px 30px; }
</pre>
<h3 class="post_h3">5. ボーダーの色を短く指定</h3>
<p>同様にボーダーの色も上、右、下、左の順に指定できます。</p>
<pre class="brush: css; title: ; notranslate">
#main{ border-color: #ccc #666 #666 #ccc; }
</pre>
<h3 class="post_h3">6. フォントのプロパティを短く指定</h3>
<p>さらにフォントのプロパティも短くできます。<code>body { font: font-style font-variant font-weight font-size line-height font-family; }</code>の順に指定。全てを指定する必要はないので、必要なもの以外は省いてOK。</p>
<pre class="brush: css; title: ; notranslate">
body { font: italic small-caps bold 14px/25px Verdana, Arial, Helvetica, sans-serif; }
</pre>
<h3 class="post_h3">7. リンクの点線を消去</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo7.gif" alt="CSS: リンクの点線を消去" title="リンクの点線を消去" width="500" height="173" class="alignnone size-full wp-image-1114" /></p>
<p>リンクをクリックしたときに表示される点線を消去。</p>
<p><strong>追記: </strong>私の場合かなりの確率でクライアントから依頼があり消していますが、これをするとタブキーを使ってリンクを辿る際、どこにフォーカスしているかわからなくなります。</p>
<pre class="brush: css; title: ; notranslate">
a{ outline: none; }
</pre>
<h3 class="post_h3">8. 画像リンクのラインを消去</h3>
<p>画像にリンクを張ったとき、aタグに指定された色の線が表示されると思います。それを消去しちゃいます。</p>
<pre class="brush: css; title: ; notranslate">
img{ border: none; }
</pre>
<h3 class="post_h3">9. 透明度を変更</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo9.gif" alt="CSS: 透明度を変更" title="透明度を変更" width="500" height="210" class="alignnone size-full wp-image-1115" /></p>
<p>各数値を変更して透明度を変更。</p>
<p><a href="/sample-css-tips20#demo9" class="btn_sample" target="_blank">サンプル</a></p>
<pre class="brush: css; title: ; notranslate">
.image{
    filter:alpha(opacity=50);  /* IE7以下用 */
    -ms-filter: &quot;alpha(opacity=50)&quot;; /* IE8用 */
    -moz-opacity:0.5; /* Firefox 1.5未満, Netscape用 */
    -khtml-opacity: 0.5;  /* Safari 1.x, 他khtmlに対応したブラウザ用  */
    opacity: 0.5; /* Firefox 1.5以上, Opera, Safari用 */
    }
</pre>
<h3 class="post_h3">10. ブラウザー毎にCSSを変える</h3>
<p>IE用にCSSを変える場合、header内に以下の条件を記述することで実装できます。</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!--[if IE]&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;ie.css&quot; /&gt;
&lt;![endif]--&gt;
</pre>
<p>IEのバージョン毎にCSSを変える場合は上記[if IE]の部分を下記に変更。</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!--[if IE 6]&gt; →IE6のみ --&gt;
&lt;!--[if gt IE 6]&gt; →IE7以上 --&gt;
&lt;!--[if lt IE 6]&gt; →IE6未満 --&gt;
&lt;!--[if gte IE 6]&gt; →IE6以上 --&gt;
&lt;!--[if lte IE 6]&gt; →IE6以下 --&gt;
</pre>
<h2 class="post_h2">いろいろ使える画像編</h2>
<h3 class="post_h3">11. マウスオーバーで画像を変更</h3>
<p>これにはいろんなやり方があります。以前書いた<a href="/tech/css-sprite/" target="_blank">CSSスプライト</a>もその一つ。今回は２枚の画像を使ったやり方を紹介します。まずはdivにマウスオーバー時に表示される画像を背景画像として指定。その中に通常時の画像を置きます。そして<code>visibility: hidden;</code>でマウスオーバーしたときに通常時の画像を隠します。</p>
<p><a href="/sample-css-tips20#demo11" class="btn_sample" target="_blank">サンプル</a></p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;btn&quot;&gt;
    &lt;a href=&quot;#&quot;&gt;
        &lt;img src=&quot;btn.jpg&quot; width=&quot;200&quot; height=&quot;60&quot; /&gt;
    &lt;/a&gt;
&lt;/div&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
div.btn{
    background: url(btn-hover.jpg) no-repeat;
    width: 200px;
    height: 60px;
    }
    div.btn a { display: block; }
        div.btn a:hover{ background: none; }
	    div.btn a:hover img { visibility: hidden; }
</pre>
<h3 class="post_h3">12. ファビコン</h3>
<p>URLアドレスバーの横にちょこんとある小さな画像、ファビコンを作成。まずはPhotoshop、Illustratorなどで16px四方の画像を作成し、.gifか.pngで保存。その画像を<a href="http://www.html-kit.com/favicon/" target="_blank">.icoに変換してくれるサイト</a>などで.ico画像を作ります。その後header内に以下を記述すればファビコン設置完了です。（わざわざ.gifから.icoに変換しなくてもWindowsのPhotoshopなら別名保存から.icoで保存できるらしい。。？Windows使わないのでこの辺よくわかりません。。）</p>
<pre class="brush: xml; title: ; notranslate">
&lt;link rel=&quot;icon&quot; href=&quot;favicon.ico&quot; type=&quot;image/x-icon&quot; /&gt;
&lt;link rel=&quot;shortcut icon&quot; href=&quot;favicon.ico&quot; type=&quot;image/x-icon&quot; /&gt;
</pre>
<h3 class="post_h3">13. ページサムネイル画像</h3>
<p>ソーシャルブックマークサイト等に表示されるサムネイル画像を指定します。（動作しないサイトもあり？）headerに下記を記述。</p>
<pre class="brush: xml; title: ; notranslate">
&lt;link rel=&quot;image_src&quot; href=&quot;thumb.jpg&quot; /&gt;
</pre>
<h3 class="post_h3">14. 画像の好きな部分を切り抜く</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo14-1.gif" alt="clip: rect" title="画像の好きな部分を切り抜く" width="316" height="216" class="alignnone size-full wp-image-1116" /></p>
<p>clipを使って画像を好きな位置で切り抜きます。サムネイル画像なんかに使えそうですね。divに<code>position: relative;</code>を、中に入れる画像に<code>position: absolute;</code>を使うのがポイント。<code>clip: rect</code>の値は少しわかりづらいのですが、下の図を参考にしてみてください。</p>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo14-2.gif" alt="clip: rect" title="画像の好きな部分を切り抜く 2" width="470" height="349" class="alignnone size-full wp-image-1117" /><br />
<a href="/sample-css-tips20#demo14" class="btn_sample" target="_blank">サンプル</a></p>
<pre class="brush: css; title: ; notranslate">
div {
  position: relative;
  height: 130px;
  width: 200px;
  border: solid 1px #ccc;
}
div img {
  position: absolute;
  clip: rect(30px 165px 100px 30px);
}
</pre>
<h2 class="post_h2">かゆいところに手が届く応用編</h2>
<h3 class="post_h3">15. 長いURLを途中で折返す</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo15.gif" alt="CSS word wrap" title="長いURLを途中で折返す" width="500" height="270" class="alignnone size-full wp-image-1118" /></p>
<p>URLなどの長い英単語が続くとうまく改行せず続けて表示されてしまいます。その問題は<code>word-wrap</code>で解決。</p>
<p><a href="/sample-css-tips20#demo15" class="btn_sample" target="_blank">サンプル</a></p>
<pre class="brush: css; title: ; notranslate">
ul li{ word-wrap: break-word; }
</pre>
<h3 class="post_h3">16. 逆に途中で折り返さず、次の行に</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo16.gif" alt="逆に途中で折り返さず、次の行に" title="逆に途中で折り返さず、次の行に" width="500" height="185" class="alignnone size-full wp-image-1119" /></p>
<p>図のように次の行に表示させたい場合はこちらが有効。</p>
<p><a href="/sample-css-tips20#demo16" class="btn_sample" target="_blank">サンプル</a></p>
<pre class="brush: css; title: ; notranslate">
p span { white-space: nowrap; }
</pre>
<h3 class="post_h3">17. リストの最初の仕切り線を消去</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo17.gif" alt="css overflow hidden" title="リストの最初の仕切り線を消去" width="500" height="223" class="alignnone size-full wp-image-1120" /></p>
<p>仕切りのボーダーを表示する際、各リストにボーダーを指定すると思いますが、その場合トップ（もしくはボトム）にも線がついてしまって悩んでいるあなた！<code>overflow: hidden; </code>を使えば簡単に解決できます！</p>
<p><a href="/sample-css-tips20#demo17" class="btn_sample" target="_blank">サンプル</a></p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;ul&gt;
    &lt;li&gt;リストメニュー 1&lt;/li&gt;
    &lt;li&gt;リストメニュー 2&lt;/li&gt;
    &lt;li&gt;リストメニュー 3&lt;/li&gt;
    &lt;li&gt;リストメニュー 4&lt;/li&gt;
    &lt;li&gt;リストメニュー 5&lt;/li&gt;
&lt;/ul&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
ul {
    _zoom: 1;
    overflow: hidden;
    }
    ul li {
	margin-top: -1px;
	padding: 5px;
	border-top: 1px dotted #999;
	}
</pre>
<h3 class="post_h3">18. ２行目以降にスペースを</h3>
<p>※を使った注意事項などに使える小技。最初の行は通常に、次の行からは一文字分開けて表示します。</p>
<p><a href="/sample-css-tips20#demo18" class="btn_sample" target="_blank">サンプル</a></p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;※注意事項系に使えるようなサンプル&lt;br /&gt;
注意事項系に使えるようなサンプル&lt;/p&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
p{
    padding-left: 1em;
    text-indent: -1em;
    }
</pre>
<h3 class="post_h3">19. min-height</h3>
<p>divなどの最低限表示する高さを指定。例えば最低500pxは表示させ、あとはコンテンツによってどんどん長くなる。。というdivに有効です。IE6ではmin-heightが動いてくれないので、下記のように指定すると動いてくれます。</p>
<p><a href="/sample-css-tips20#demo19" class="btn_sample" target="_blank">サンプル</a></p>
<pre class="brush: css; title: ; notranslate">
.minheight {
  min-height:500px;
  height:auto !important;
  height:500px;
}
</pre>
<h3 class="post_h3">20. 横並びブロックのマージンを調節</h3>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/04/demo20.gif" alt="css overflow hidden" title="横並びブロックのマージンを調節" width="500" height="164" class="alignnone size-full wp-image-1121" /></p>
<p>div内にある横並びブロックにマージンを、でも最初と最後のブロックをdivの幅に合わせる方法。何かと使う機会が多いです。</p>
<p><a href="/sample-css-tips20#demo20" class="btn_sample" target="_blank">サンプル</a></p>
<h4 class="post_h4">HTML</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;div&gt;
    &lt;ul&gt;
             &lt;li&gt;&lt;img src=&quot;image/001.jpg&quot; alt=&quot;サンプル画像1&quot; width=&quot;150&quot; height=&quot;100&quot; /&gt;&lt;/li&gt;
             &lt;li&gt;&lt;img src=&quot;image/002.jpg&quot; alt=&quot;サンプル画像2&quot; width=&quot;150&quot; height=&quot;100&quot; /&gt;&lt;/li&gt;
              &lt;li&gt;&lt;img src=&quot;image/003.jpg&quot; alt=&quot;サンプル画像3&quot; width=&quot;150&quot; height=&quot;100&quot; /&gt;&lt;/li&gt;
   &lt;/ul&gt;
&lt;/div&gt;
</pre>
<h4 class="post_h4">CSS</h4>
<pre class="brush: css; title: ; notranslate">
div{
    width: 470px;
    border:2px solid #F33;
    }

   div ul {
             width: 480px;
             margin-right: -10px;
             overflow: hidden;
             _zoom: 1;
             }

             div ul li {
                          float: left;
                          margin-right: 10px;
                          }
</pre>
<p></br /><br />
参照サイト:</p>
<ul class="post_ul">
<li><a href="http://www.webdesignerwall.com/tutorials/5-simple-but-useful-css-properties/" target="_blank">Web Designer Wall</a></li>
<li><a href="http://www.css-lecture.com/log/css/coding-css-technique.html?utm_source=feedburner&#038;utm_medium=feed&#038;utm_campaign=Feed%3A%20css-lecture%20%28CSS%20Lecture%29&#038;utm_content=Google%20Reader" target="_blank">CSS Lecture</a></li>
<li><a href="http://www.instantshift.com/2010/03/15/47-css-tips-tricks-to-take-your-site-to-the-next-level/" target="_blank">instant Shift</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.webcreatorbox.com/tech/css-tips20/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>CSSハック一覧 &#8211; IE, Firefox, Safariなどなど</title>
		<link>http://www.webcreatorbox.com/tech/css-hack-list/</link>
		<comments>http://www.webcreatorbox.com/tech/css-hack-list/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 01:46:58 +0000</pubDate>
		<dc:creator>Webクリエイターボックス</dc:creator>
				<category><![CDATA[Web制作テクニック]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.webcreatorbox.com/?p=538</guid>
		<description><![CDATA[異なるブラウザーで見たらレイアウトが崩れる。。CSSハックはそんな時のお役立ち裏技（？）です。私がブックマークしているCSSハックに関するWebサイトがたくさんあったので（Safariがのってない・IE8しかのってない。 [...]]]></description>
			<content:encoded><![CDATA[<p>異なるブラウザーで見たらレイアウトが崩れる。。CSSハックはそんな時のお役立ち裏技（？）です。私がブックマークしているCSSハックに関するWebサイトがたくさんあったので（Safariがのってない・IE8しかのってない。。等の理由で）、自分用メモ。「こんなやり方もある！」というのがあればコメントして教えてください！</p>
<p><span id="more-538"></span><br />
<a href="http://www.green-japan.com/" target="_blank" onClick="_gaq.push(['_trackEvent', 'Ads', 'click', 'A']);"><img class="ad_468x60" border="0" width="468" height="60" alt="IT系、Web業界の求人に強い転職サイト【green】" src="http://webcreatorbox.com/wp-content/themes/wcb2/images/ads/green-banner.jpg"></a></p>
<h2 class="post_h2">Internet Explorer</h2>
<h3 class="post_h3">IE6以下</h3>
<pre class="brush: css; title: ; notranslate">
#help_me { _color: blue; }

* html #help_me  { color: red; }
</pre>
<h3 class="post_h3">IE7</h3>
<pre class="brush: css; title: ; notranslate">
*:first-child+html #help_me { color: red; } 

*+html #help_me {  color: red; }
</pre>
<h3 class="post_h3">IE6, IE7</h3>
<pre class="brush: css; title: ; notranslate">
#help_me { /color: blue; }
</pre>
<h3 class="post_h3">IE8</h3>
<pre class="brush: css; title: ; notranslate">
#help_me { color: blue\9; }
</pre>
<h3 class="post_h3">IE7, IE8</h3>
<pre class="brush: css; title: ; notranslate">
#help_me { color/*\**/: blue\9; }
</pre>
<h3 class="post_h3">IE6以外</h3>
<pre class="brush: css; title: ; notranslate">
#help_me { color/**/: blue; }
</pre>
<h3 class="post_h3">IE6, IE7以外</h3>
<pre class="brush: css; title: ; notranslate">
html&gt;/**/body #help_me { color: red; }
</pre>
<h3 class="post_h3">IE6〜IE8以外</h3>
<pre class="brush: css; title: ; notranslate">
:root *&gt; #help_me { color: red;  }
</pre>
<h2 class="post_h2">モダンブラウザ</h2>
<h3 class="post_h3">Firefox</h3>
<pre class="brush: css; title: ; notranslate">
#help_me,  x:-moz-any-link  { color: red; }
</pre>
<h3 class="post_h3">Firefox 3.0以上</h3>
<pre class="brush: css; title: ; notranslate">
#help_me,  x:-moz-any-link, x:default  { color: red; }
</pre>
<h3 class="post_h3">Safari 2-3</h3>
<pre class="brush: css; title: ; notranslate">
html[xmlns*=&quot;&quot;] body:last-child #help_me { color: red; }
</pre>
<h3 class="post_h3">Safari 2 &#8211; 3.1</h3>
<pre class="brush: css; title: ; notranslate">
html[xmlns*=&quot;&quot;]:root #help_me  { color: red; }
</pre>
<h3 class="post_h3">Safari 2 &#8211; 3.1, Opera 9.25</h3>
<pre class="brush: css; title: ; notranslate">
*|html[xmlns*=&quot;&quot;] #help_me { color: red;  }
</pre>
<h3 class="post_h3">Safari 3以上, Chrome</h3>
<pre class="brush: css; title: ; notranslate">
@media screen and (-webkit-min-device-pixel-ratio:0) {
 #help_me  { color: red;  }
}
</pre>
<h3 class="post_h3">Safari 3以上, Chrome, Opera 9以上, Firefox 3.5以上</h3>
<pre class="brush: css; title: ; notranslate">
body:nth-of-type(1) #help_me { color: red; }

body:first-of-type #help_me {  color: red; }
</pre>
<h3 class="post_h3">Opera 9.25以上</h3>
<pre class="brush: css; title: ; notranslate">
;;body #help_me {  color: red; }

html:\66irst-child #help_me {  color: red; }
</pre>
<h3 class="post_h3">Opera 8, 9以外</h3>
<pre class="brush: css; title: ; notranslate">
body[class|=&quot;hypen-ated&quot;] #help_me {  color: red; }
</pre>
<h2 class="post_h2">iPhone</h2>
<p>iPhoneのみCSSを変える場合はiPhone用CSSを作成して読み込ませます。</p>
<pre class="brush: xml; title: ; notranslate">
&lt;link media=&quot;only screen and (max-device-width: 480px)&quot; href=&quot;iphone.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; /&gt;
</pre>
<p>ブックマークしていたCSSハックのサイトの中にiPhone用ハックもありました。iPhone持ってないのでテストできませんが&#8230; 一応載せておきます。</p>
<pre class="brush: css; title: ; notranslate">
/* iPhone / mobile webkit */
@media screen and (max-device-width: 480px) {
 #help_me { color: red;  }
}
</pre>
<p></p>
<p>これでたくさんありすぎてごちゃごちゃしていたブックマークが整理できる。。なるべくCSSハックを使わないですむようなデザインができれば一番いいんですけどね。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webcreatorbox.com/tech/css-hack-list/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>迷惑メールのこないEメールアドレス表示方法</title>
		<link>http://www.webcreatorbox.com/tech/display-email-address-without-spam/</link>
		<comments>http://www.webcreatorbox.com/tech/display-email-address-without-spam/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 23:55:59 +0000</pubDate>
		<dc:creator>Webクリエイターボックス</dc:creator>
				<category><![CDATA[Web制作テクニック]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Webサイト制作]]></category>

		<guid isPermaLink="false">http://www.webcreatorbox.com/?p=202</guid>
		<description><![CDATA[EメールアドレスをWebサイトに表示させたい。でも迷惑メールは受け取りたくない&#8230; 誰もが思っていることですよね。一般的にはEメールアドレスを画像にして公開しているWebサイトが多いと思います。画像以外に表示す [...]]]></description>
			<content:encoded><![CDATA[<p>EメールアドレスをWebサイトに表示させたい。でも迷惑メールは受け取りたくない&#8230; 誰もが思っていることですよね。一般的にはEメールアドレスを画像にして公開しているWebサイトが多いと思います。画像以外に表示する方法はないかな？と思っていたところ、<a href="http://techblog.tilllate.com/" target="_blank">techblog.tilllate.com</a>のSilvan Muhlemann氏がCSSを使った迷惑メール対策を紹介していました。その中からCSSを使ったすぐにでも実装できる簡単な方法を紹介します。</p>
<p><span id="more-202"></span><br />
<a href="http://www.green-japan.com/" target="_blank" onClick="_gaq.push(['_trackEvent', 'Ads', 'click', 'A']);"><img class="ad_468x60" border="0" width="468" height="60" alt="IT系、Web業界の求人に強い転職サイト【green】" src="http://webcreatorbox.com/wp-content/themes/wcb2/images/ads/green-banner.jpg"></a></p>
<p>2006年、Silvan氏はどの方法でEメールアドレスを表示すれば迷惑メールを受け取りにくいのかを調べるため、９つのEメールアドレスを作成し、それぞれ違う方法で表示して１年半の間Webサイト上に掲載してみました。送られたメールは21MB。</p>
<p><img src="http://www.webcreatorbox.com/wp-content/uploads/2010/01/obfuscation_methods.jpg" alt="迷惑メール対策方法と、受け取った迷惑メールの数" title="迷惑メール対策方法と、受け取った迷惑メールの数" width="430" height="284" class="alignnone size-full wp-image-274" /></p>
<h2 class="post_h2">CSSコードの表示方向を反転させる</h2>
<h3 class="post_h3">表示結果</h3>
<p>
<span class="codedirection">moc.etalllit@7raboofnavlis</span>
</p>
<h3 class="post_h3">コーディング</h3>
<p>HTMLコーディング</p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;
    &lt;span class=&quot;codedirection&quot;&gt;
        moc.etalllit@7raboofnavlis
    &lt;/span&gt;
&lt;/p&gt;
</pre>
<p>CSSコーディング</p>
<pre class="brush: css; title: ; notranslate">
span.codedirection {
    direction:rtl;
    unicode-bidi:bidi-override;
    }
</pre>
<h2 class="post_h2">CSS display:none; を使用する</h2>
<h3 class="post_h3">表示結果</h3>
<p>silvanfoobar8@<span class="hide">null</span>tilllate.com</p>
<h3 class="post_h3">コーディング</h3>
<p>HTMLコーディング</p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;
    silvanfoobar8@
    &lt;span class=&quot;hide&quot;&gt;null&lt;/span&gt;
    tilllate.com
&lt;/p&gt;
</pre>
<p>CSSコーディング</p>
<pre class="brush: css; title: ; notranslate">
p span.hide { display:none; }
</pre>
<p>上記2つの表示方法だと１年半の間、迷惑メールを全く受け取らなかったようなので、迷惑メール対策に効果的ですね。ただし両方とも表示させるためだけのコードなので、実際にコピー・ペーストすると正しいEメールアドレスは表示されません。その他、迷惑メール対策に効果的な方法があれば是非是非コメントください！</p>
<p>参考Webサイト: <a href="http://techblog.tilllate.com/2008/07/20/ten-methods-to-obfuscate-e-mail-addresses-compared/" target="_blank">techblog.tilllate.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webcreatorbox.com/tech/display-email-address-without-spam/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

