• 회원가입
  • 로그인
  • 구글아이디로 로그인

[selector] CSS - [attribute] 속성선택자 - 특정 속성 보유 요소 (IE7) ※ 여러 속성 보유 선택자

목차
  1. [attribute] 속성선택자 정의
  2. [attribute] 속성선택자 구문
  3. [attribute] 속성선택자 예제

 

[attribute] 속성선택자 정의 

 
속성값 (_blank, new, _self)에 상관없이 특정 속성(예:target)을 갖고 있는 특정 태그 요소 선택.
(ex) a[target] 선택자 - a 태그 중 target 속성 보유한 요소 선택.
 

 

※ jQuery [attribute] 속성선택자.

※ IE7 이상.

 
 

[attribute] 속성선택자 구문

※ 사용 가능한 여러 형태.

 

  • 요소[attr] { ... }
  • 요소[attr1] [attr2] ...{ ... }
  • 요소[attr1=value1] { ... }
  • 요소[attr1=value1] [attr2=value2] ... { ... }
  • 요소[attr1] [attr2] [attr3=value3][attr4=value4]... { ... }

 

PS. 속성값을 따옴표로 안 묶아도 됨.

 

[attribute] 속성선택자 예제

[예제1] - [속성]


<style>
a[target]{color:red;}
</style>

<p><a href=https://homzzang.com target="_blank">홈짱닷컴 새창 열기</a></p>
<p><a href=https://homzzang.com target=new>홈짱닷컴 새창 열기</a></p>
<p><a href=https://homzzang.com target=_self>홈짱닷컴 본창 열기</a></p>


예제2 - [속성 = 속성값]

 

<style>

input[type='text'] {height:40px; color:red;}

</style>

<input type="text" value='홈짱닷컴 Homzzang.com'>

<input type="submit">


결과보기


예제3 - [속성1][속성2=속성값2]

 

<style>

input[type][value='a'] {color:red;}

</style>


<input type="text" value='a'>

<input type="text" value='b'>

<input type="text" value='c'>

<input type="text" value='d'>

 

결과보기 


방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
게시물이 없습니다.
목록
찾아주셔서 감사합니다. Since 2012