小编典典

a [href ^ =“…”]在CSS中做什么?

css

我以前使用过CSS,但遇到过以下CSS样式,不知道它的作用。

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

阅读 562

收藏
2020-05-16

共1个答案

小编典典

a[href^=”http:”]

选择属性值以开头的<a>元素。href``http:

例如:

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

将符合以下条件:

<p title="paragraph"> This paragraph should have a green background. </p>
2020-05-16