[attr|=val]
correspond à un mot val
sous quelque forme, donc [class=div]
correspondrait .my-div
, .div
, mais pas .mydiv
.
[attr~=val]
correspond à un mot complet en val
, donc [class~=div]
sélectionnne .div', but not
.mydiv or
.mon-div`.
Exemple:
HTML
<div id="myDiv"></div>
<div id="myDiv2"></div>
<div id="new-div"></div>
CSS
div[id|=myDiv] {
/* Matches the first div */
}
div[id|=my]{
matches first two divs
}
div[id|=new]{
/* Matches second div - the hyphen counts as a word separator */
}
div[id~=Div]{
/* Matches nothing - "Div" is not a separate word */
}
http://stackoverflow.com/questions/10442963/how-exactly-is-att-val-different -from-att-val-dans-css-attribut-sélecteurs –
http://stackoverflow.com/questions/34530852/what-is-the-difference-between-pipe-and-caret-attribute-selectors –
'[attr | = val]' dans cette condition sont vraiment disponibles? – prasanth