SlideShare a Scribd company logo
id	属性	
class	属性	
	
を使おう!
id属性、class属性 を使おう!	
<h3>会社概要</h3>	
	
<h3>お問い合わせ</h3>	
【html】	
文字色をつけたい
<h3>会社概要</h3>	
	
<h3>お問い合わせ</h3>	
h3	{	
	 color:#009900;	
}	
【css】	
id属性、class属性 を使おう!	
【html】	
文字色をつけたい
<h3>会社概要</h3>	
	
<h3>お問い合わせ</h3>	
h3	{	
	 color:#009900;	
}	
【css】	
id属性、class属性 を使おう!	
【html】	
それぞれ違う	
文字色にしたい
<h3	class=“about”>会社概要</h3>	
	
<h3	class=“contact”>お問い合わせ</h3>	
id属性、class属性 を使おう!	
【html】	
【css】	
h3	{	
	 color:#009900;	
}	
それぞれ違う	
文字色にしたい
【css】	
id属性、class属性 を使おう!	
【html】	
h3.about{	
	 color:#009900;	
}	
	
h3.contact{	
				color:#990000;	
}	
それぞれ違う	
文字色にしたい	
<h3	class=“about”>会社概要</h3>	
	
<h3	class=“contact”>お問い合わせ</h3>
<h3	id=“about”>会社概要</h3>	
	
<h3	id=“contact”>お問い合わせ</h3>	
【css】	
id属性、class属性 を使おう!	
【html】	
h3#about{	
	 color:#009900;	
}	
	
h3#contact{	
				color:#990000;	
}	
それぞれ違う	
文字色にしたい
セレクターの意味	
  .	
			classの指定	
  #	
						idの指定	
*idはページ内に1つしか	
  出てこない要素
タグでの絞り込み	
h3.about	⇦	h3タグのabout	
	
p.about	⇦	pタグのabout	
	
.about	⇦	about	class全部	
<h3	class=“about”>会社概要</h3>	
	
<p	class=“abouA”>創立1995年です。</h3>
階層での絞り込み	
<div	class=“about”>	
						<h3>…</h3>	
</div>	
	
<div	class=“contact”>	
						<h3>…</h3>	
</div>	
.about	h3{	
	 color:#009900;	
}	
	
.contact	h3{	
				color:#990000;	
}	
	
【Index.html】	 【style.css】
CSSの上書き	
P{	
				color:#009900;	
}	
	
P{	
				color:#000000;	
}	
セレクタが一緒
CSSの上書き	
P{	
				color:#009900;	
}	
	
P{	
				color:#000000;	
}	
後ろが優先
CSSの上書き	
.about	h3{	
				color:#009900;	
}	
	
h3{	
				color:#000000;	
}	
セレクターが多い方が優先	
<div	class=“about”>	
		<h3>…</h3>	
</div>	
【Index.html】	
【style.css】
CSSの上書き	
#aaa{	
				color:#009900;	
}	
	
.bbb{	
				color:#000000;	
}	
IDが優先	
<h3	id=“aaa”	class=“bbb”>…</h3>	
【Index.html】	
【style.css】
*  ユニバーサルセレクタ 	
すべての要素が対象	
*{	
				margin:0;	
				padding:0;	
}	
優先順位は最下位
!important	
p	{	
	 	color:	red	!important;	
	}	
最優先になる
CSSのポイント換算	
タグ	 1	point	
クラス	 10	point	
ID	 100	point

More Related Content

PPTX
Cssセレクタ
PDF
Css
PDF
PDF
イマドキの「タグ=HTML」とスタイルシート=CSS」を知ろう
PDF
Html:css
PDF
PPT
CSS勉強会
PDF
Cssセレクタ
Css
イマドキの「タグ=HTML」とスタイルシート=CSS」を知ろう
Html:css
CSS勉強会

More from sayoko miura (20)

PDF
miuratta-standard.pdf
PDF
group-html
PDF
PDF
PDF
Child.key
PDF
Clearfix.key
PDF
PDF
Prevnext
PDF
J query place
PDF
PDF
Event.key
PDF
Readyevent
PDF
J query element.key
PDF
J query ready2.key
PDF
WhatsjQuery
PDF
PDF
Web2 mission
PDF
PDF
PPTX
Display
miuratta-standard.pdf
group-html
Child.key
Clearfix.key
Prevnext
J query place
Event.key
Readyevent
J query element.key
J query ready2.key
WhatsjQuery
Web2 mission
Display
Ad

Css selector