2013-10-27 40 views
2

這將讓我選擇與educationalTraining的名字「一」標籤:如何使用CSS選擇具有任意名稱屬性的標籤?

a[name=educationalTraining] { 
    color: rgb(89, 91, 91); 
} 

我怎麼會得到所有「A」標籤使用任何名稱。這似乎沒有工作:

a[name=*] { 
    color: rgb(89, 91, 91); 
} 

不幸的是,我不能只選擇任何「a」標籤。這是唯一使用該名稱的屬性,我感興趣的

+1

一【名稱】{... css ...} – mash

回答

10

嘗試:

a[name] { 
    color: rgb(89, 91, 91); 
} 

演示:http://jsfiddle.net/gQL9J/

+2

請參閱(其他地方)CSS2規範(http://www.w3.org/TR/CSS2/selector.html#attribute-selectors)和此MDN頁面(https://developer.mozilla .org/en-US/docs/Web/CSS/Attribute_selectors)信息。 –

3

嘗試:

a[name] { 
    color: rgb(89, 91, 91); 
} 
相關問題