[href ^ =" ..."]在CSS中做什么? [英] What does a[href^="..."] do in CSS?

查看:104
本文介绍了[href ^ =" ..."]在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:没有; padding-right:0;
}


解决方案

  a [href ^ =http:] 

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

例如:

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

 < p title =paragraph>这一段应该有一个绿色的背景。 < / p> 


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^="http://mysite.com"], a[href^="http://www.mysite.com"] {
   background-image: none; padding-right:0;
}

解决方案

a[href^="http:"] 

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> 

这篇关于[href ^ =&quot; ...&quot;]在CSS中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆