E[attr^=val]
ie7 ie8 ie9 firefox chrome safari opera
'attr' 속성의 값이 'val'으로 시작하는 요소를 선택예제 보기
Mark up
.attrStartChar::after {display:block;clear:both;content:''}
.attrStartChar > li {float:left;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.attrStartChar > li[title^=Chrome] {border:3px solid purple}
<ul class="attrStartChar">
<li title="Internet Explorer">Internet Explorer</li>
<li title="Firefox Browser">Firefox</li>
<li title="Chrome Browser">Google Chrome</li>
<li title="Safari Browser">Apple Safari</li>
</ul>
Result
Internet Explorer
Firefox
Google Chrome
Apple Safari
E[attr$=val]
ie7 ie8 ie9 firefox chrome safari opera
'attr' 속성의 값이 'val'으로 끝나는 요소를 선택예제 보기
Mark up
.attrEndChar::after {display:block;clear:both;content:''}
.attrEndChar > li {float:left;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.attrEndChar > li[title$=Browser] {border:3px solid purple}
<ul class="attrEndChar">
<li title="Internet Explorer">Internet Explorer</li>
<li title="Firefox Browser">Firefox</li>
<li title="Chrome Browser">Google Chrome</li>
<li title="Safari Browser">Apple Safari</li>
</ul>
Result
Internet Explorer
Firefox
Google Chrome
Apple Safari
E[attr*=val]
ie7 ie8 ie9 firefox chrome safari opera
'attr' 속성의 값에 'val'이 포함된 요소를 선택예제 보기
Mark up
.attrAllChar::after {display:block;clear:both;content:''}
.attrAllChar > li {float:left;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.attrAllChar > li[title*=icon] {border:3px solid purple}
<ul class="attrAllChar">
<li title="icon creator">icon creator</li>
<li title="nice graphics">nice graphics</li>
<li title="amazing icon list">amazing icon list</li>
<li title="greate png icons 25">greate png icons 25</li>
</ul>
Result
icon creator
nice graphics
amazing icon list
greate png icons 25
E:root
ie9 firefox chrome safari opera
문서의 최상위 요소(html, xml) 선택예제 ON
E:nth-child(n)
ie9 firefox chrome safari opera
앞으로부터 지정된 순서와 일치하는 요소가 E라면 선택 (E아닌 요소의 순서가 계산에 포함됨)예제 보기
Mark up
.nthC_list::after {display:block;clear:both;content:''}
.nthC_list > li{float:left;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.nthC_list.num {float:left;margin-right:30px}
.nthC_list.num span, .nthC_list.num p {display:inline-block;margin:5px;padding: 5px 10px;border:3px solid #ddd;box-sizing:border-box}
.nthC_list.num span:nth-child(3) {border:3px solid purple}
.nthC_list.odd_list > li:nth-child(odd) {border:3px solid purple}
.nthC_list.even_list > li:nth-child(even) {border:3px solid purple}
.nthC_list.etc > li:nth-child(3n+2) {border:3px solid purple}
<div class="nthC_list num">
<p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p><br><p>P Element</p>
</div>
<div class="nthC_list num">
<p>P Element</p><br><p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p>
</div>
<ul class="nthC_list odd_list">
<li>John William Mauchly</li>
<li>John Adam Presper Eckert Jr.</li>
<li>John Vincent Atanasoff</li>
<li>Clifford Edward Berry</li>
</ul>
<ul class="nthC_list even_list">
<li>John William Mauchly</li>
<li>John Adam Presper Eckert Jr.</li>
<li>John Vincent Atanasoff</li>
<li>Clifford Edward Berry</li>
</ul>
<ul class="nthC_list etc">
<li>list1</li>
<li>list2</li>
<li>list3</li>
<li>list4</li>
<li>list5</li>
<li>list6</li>
<li>list7</li>
<li>list8</li>
</ul>
Result
:nth-child(3) :nth-child(odd) :nth-child(even) :nth-child(3n+2)
P Element
Span Element
P Element
P Element
P Element
P Element
P Element
Span Element
P Element
P Element
John William Mauchly
John Adam Presper Eckert Jr.
John Vincent Atanasoff
Clifford Edward Berry
John William Mauchly
John Adam Presper Eckert Jr.
John Vincent Atanasoff
Clifford Edward Berry
list1
list2
list3
list4
list5
list6
list7
list8
E:nth-last-child(n)
ie9 firefox chrome safari opera
뒤로부터 지정된 순서와 일치하는 요소가 E라면 선택 (E아닌 요소의 순서가 계산에 포함됨)예제 보기
Mark up
.nthLc_wrap {float:left;margin-right:30px}
.nthLc_wrap > p, .nthLc_wrap > span {display:inline-block;margin:5px;padding: 5px 10px;border:3px solid #ddd;box-sizing:border-box}
.nthLc_wrap > span:nth-last-child(4) {border:3px solid purple}
<div class="nthLc_wrap">
<p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p><br><p>P Element</p>
</div>
<div class="nthLc_wrap">
<p>P Element</p><br><p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p>
</div>
Result
P Element
Span Element P Element
P Element
P Element
P Element
P Element
Span Element P Element
P Element
E:nth-of-type(n)
ie9 firefox chrome safari opera
E 요소 중 앞으로부터 순서가 일치하는 요소 선택 (E 요소의 순서만 계산에 포함됨)예제 보기
Mark up
.nthOt_wrap span {display:inline-block;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.nthOt_wrap span:nth-of-type(5) {border:3px solid purple}
<div class="nthOt_wrap">
<span>DOS</span><br><span>Windows</span><br><span>Mac OS</span><span>UNIX</span><br><span>LINUX</span>
</div>
Result
DOS Windows Mac OS UNIX LINUX
E:nth-last-of-type(n)
ie9 firefox chrome safari opera
E 요소 중 끝으로부터 순서가 일치하는 요소 선택 (E 요소의 순서만 계산에 포함됨)예제 보기
Mark up
.nthLot_wrap span, .nthLot_wrap p {display:inline-block;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.nthLot_wrap span:nth-last-of-type(1) {border:3px solid purple}
<div class="nthLot_wrap">
<p>P Element</p><br><p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p>
</div>
Result
P Element
P Element
Span Element P Element
P Element
E:last-child
ie9 firefox chrome safari opera
마지막에 등장하는 요소가 E라면 선택 (E 아닌 요소의 순서가 계산에 포함됨)예제 보기
Mark up
.lc_wrap {float:left;margin-right:30px}
.lc_wrap span, .lc_wrap p {display:inline-block;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.lc_wrap span:last-child {border:3px solid purple}
<div class="lc_wrap">
<p>P Element</p><br><p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p>
</div>
<div class="lc_wrap">
<p>P Element</p><br><p>P Element</p><br><p>P Element</p><br><p>P Element</p><br><span>Span Element</span>
</div>
Result
P Element
P Element
Span Element P Element
P Element
P Element
P Element
P Element
P Element
Span Element
E:first-of-type
ie9 firefox chrome safari opera
E 요소 중 첫 번째 E를 선택 (E 요소의 순서만 계산에 포함됨)예제 보기
Mark up
.fOt_wrap {float:left;margin-right:30px}
.fOt_wrap span, .fOt_wrap p {display:inline-block;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.fOt_wrap p:first-of-type {border:3px solid purple}
<div class="fOt_wrap">
<p>P Element</p><br><p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p>
</div>
<div class="fOt_wrap">
<span>Span Element</span><p>P Element</p><br><p>P Element</p><br><p>P Element</p><br><p>P Element</p>
</div>
Result
P Element
P Element
Span Element P Element
P Element
Span Element P Element
P Element
P Element
P Element
E:last-of-type
ie9 firefox chrome safari opera
E 요소 중 마지막 E를 선택 (E 요소의 순서만 계산에 포함됨)예제 보기
Mark up
.lOt_wrap {float:left;margin-right:30px}
.lOt_wrap span, .lOt_wrap p {display:inline-block;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.lOt_wrap span:last-of-type {border:3px solid purple}
<div class="lOt_wrap">
<p>P Element</p><br><p>P Element</p><br><span>Span Element</span><p>P Element</p><br><p>P Element</p>
</div>
<div class="lOt_wrap">
<p>P Element</p><br><p>P Element</p><br><p>P Element</p><br><p>P Element</p><br><span>Span Element</span>
</div>
Result
P Element
P Element
Span Element P Element
P Element
P Element
P Element
P Element
P Element
Span Element
E:only-child
ie9 firefox chrome safari opera
E 요소가 유일한 자식이면 선택 (E 아닌 요소가 포함되면 선택안함)예제 보기
Mark up
.oc_wrap {float:left;margin-right:30px}
.oc_wrap span, .oc_wrap p {display:inline-block;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.oc_wrap p:only-child {border:3px solid purple}
<div class="oc_wrap">
<p>P Element</p><br><span>Span Element</span>
</div>
<div class="oc_wrap">
<p>P Element</p>
</div>
Result
E:only-of-type
ie9 firefox chrome safari opera
E 요소가 유일한 타입이면 선택 (E 아닌 요소가 포함되어도 선택)예제 보기
Mark up
.oOt_wrap {float:left;margin-right:30px}
.oOt_wrap span, .oOt_wrap p {display:inline-block;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.oOt_wrap p:only-of-type {border:3px solid purple}
<div class="oOt_wrap">
<p>P Element</p><br><span>Span Element</span>
</div>
<div class="oOt_wrap">
<p>P Element</p>
</div>
Result
E:empty
ie9 firefox chrome safari opera
텍스트 및 공백을 포함하여 자식 요소가 없는 E를 선택예제 보기
Mark up
.empty_list::after {display:block;clear:both;content:''}
.empty_list > li {float:left;margin:5px;padding:5px 10px;border:3px solid #ddd;box-sizing:border-box}
.empty_list > li:empty {border:3px solid purple}
<ul class="empty_list">
<li>첫번째</li>
<li></li>
<li>세번째</li>
</ul>
Result
E:target
ie9 firefox chrome safari opera
E의 URI가 요청되면 선택 (따라서 E는 ID가 지정되어야 함)예제 보기
Mark up
.targetUl::after {display:block;clear:both;content:''}
.targetUl > li {float:left;margin-bottom:10px}
.targetUl > li > a {display:inline-block;padding:5px 10px}
.targetDiv {float:left;margin:5px;padding: 5px 10px;border:3px solid #ddd;box-sizing:border-box}
.targetDiv:target {border:3px solid purple}
<ul class="targetUl">
<li><a href="#target1">#target1 go</a></li>
<li><a href="#target2">#target2 go</a></li>
<li><a href="#target3">#target3 go</a></li>
</ul>
<div id="target1" class="targetDiv">target1</div>
<div id="target2" class="targetDiv">target2</div>
<div id="target3" class="targetDiv">target3</div>
Result
target1
target2
target3
E:enabled
ie9 firefox chrome safari opera
사용 가능한 폼 컨트롤(input, textarea, select, button) E를 선택예제 보기
Mark up
.enabled_list::after {display:block;clear:both;content:''}
.enabled_list > li {float:left;margin:5px}
.enabled_list > li input[type=text]:enabled {border:2px solid purple}
.enabled_list > li input[type=checkbox]:enabled {box-shadow: 0 0 0 2px purple}
.enabled_list > li button:enabled {border:2px solid purple;color:purple}
<ul class="enabled_list">
<li><input type="text" disabled="disabled" /></li>
<li><input type="text" /></li>
<li><input type="checkbox" disabled="disabled" /></li>
<li><input type="checkbox" /></li>
<li><button disabled="disabled">button</button></li>
<li><button>button</button></li>
</ul>
Result
E:disabled
ie9 firefox chrome safari opera
사용 불가능한 폼 컨트롤(input, textarea, select, button) E를 선택예제 보기
Mark up
.disabled_list::after {display:block;clear:both;content:''}
.disabled_list > li {float:left;margin:5px}
.disabled_list > li input[type=text]:disabled {border:2px solid purple}
.disabled_list > li input[type=checkbox]:disabled {box-shadow: 0 0 0 2px purple}
.disabled_list > li button:disabled {border:2px solid purple;color:purple}
<ul class="disabled_list">
<li><input type="text" disabled="disabled" /></li>
<li><input type="text" /></li>
<li><input type="checkbox" disabled="disabled" /></li>
<li><input type="checkbox" /></li>
<li><button disabled="disabled">button</button></li>
<li><button>button</button></li>
</ul>
Result
E:checked
ie9 firefox chrome safari opera
선택된 폼 컨트롤(input check="checked") E를 선택예제 보기
Mark up
.checked_list::after {display:block;clear:both;content:''}
.checked_list > li {float:left;margin:5px}
.checked_list > li input[type=checkbox]:checked {box-shadow: 0 0 0 2px purple}
<ul class="checked_list">
<li><input type="checkbox" /></li>
<li><input checked="checked" type="checkbox" /></li>
</ul>
Result
E:not(S)
ie9 firefox chrome safari opera
S가 아닌 E 요소를 선택예제 보기
Mark up
.not_list::after {display:block;clear:both;content:''}
.not_list > li {float:left;margin:5px;padding: 5px 10px;border:3px solid #ddd;box-sizing:border-box}
.not_list > li:not(:nth-child(2n)) {border:3px solid purple}
<ul class="not_list">
<li>list1</li>
<li>list2</li>
<li>list3</li>
<li>list4</li>
<li>list5</li>
</ul>
Result
list1
list2
list3
list4
list5
E~F
ie9 firefox chrome safari opera
E 요소가 앞에 존재하면 F를 선택예제 보기
Mark up
.wave_warp ul {margin:7px 0 20px}
.wave_warp ul:last-child {margin-bottom:0}
.wave_warp ul::after {display:block;clear:both;content:''}
.wave_warp ul > li{float:left;margin-right:15px}
.wave_warp h3~ul {color: orangered}
<div class="wave_warp">
<h3>Won</h3>
<ul>
<li>1000 <span>원</span></li>
<li>2000 <span>원</span></li>
<li>500 <span>원</span></li>
<li>100 <span>원</span></li>
</ul>
<h3>US Dollar</h3>
<ul>
<li>1 <span>달러</span></li>
<li>2 <span>달러</span></li>
</ul>
<h4>US Cent</h4>
<ul>
<li>50 <span>센트</span></li>
<li>10 <span>센트</span></li>
</ul>
</div>
Result
Won
1000 원
2000 원
500 원
100 원
US Dollar
US Cent