user443946 user443946 - 1 year ago 75
CSS Question

What does a[href^="..."] do in CSS?

I have used CSS before and I came across the below CSS style, don't have a clue what it does.

a[href^="http:"] {
background: url(img/keys.gif) no-repeat right top;
a[href^=""], a[href^=""] {
background-image: none; padding-right:0;

Answer Source

Selects an <a> element whose href attribute value begins with http:.

For example:

p[title^="para"] {background: green;}

Will match the following:

<p title="paragraph"> This paragraph should have a green background. </p> 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download