SORU
13 Ocak 2012, Cuma


CSS özniteliği seçici a href çalışmıyor

css özniteliği seçici kullanımı için farklı renk ve görüntü bağlantısını değiştirmek istiyorum. ama çalışmıyor

html var

<a href="/manual.pdf">A PDF File</a>

ve css

a {
     display: block;
     height: 25px;
     padding-left: 25px;
     color:#333;
     font: bold 15px Tahoma;
     text-decoration: none;
 }
 a[href='.pdf'] { background: red; }

arka plan neden kırmızı?

teşekkürler

CEVAP
13 Ocak 2012, Cuma


Senin href sonra $ kullanın. Bu dizenin son maç için öznitelik değerini yapacak.

a[href$='.pdf'] { /*css*/ }

JSFiddle: http://jsfiddle.net/UG9ud/

E[foo]        an E element with a "foo" attribute (CSS 2)
E[foo="bar"]  an E element whose "foo" attribute value is exactly equal to "bar" (CSS 2)
E[foo~="bar"] an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar" (CSS 2)
E[foo^="bar"] an E element whose "foo" attribute value begins exactly with the string "bar" (CSS 3)
E[foo$="bar"] an E element whose "foo" attribute value ends exactly with the string "bar" (CSS 3)
E[foo*="bar"] an E element whose "foo" attribute value contains the substring "bar" (CSS 3)
E[foo|="en"]  an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en" (CSS 2)

kaynak: http://www.w3.org/TR/selectors/

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Best Quality Cartoons

    Best Quality

    10 ŞUBAT 2014
  • ColdfusTion

    ColdfusTion

    3 Aralık 2007
  • Darren Kitchen

    Darren Kitch

    3 EKİM 2011