为什么我的以"#"开头的没有变色,只有以"#-"开头的变色。

为什么我的以"#"开头的没有变色,只有以"#-"开头的变色。

为什么我的以"#"开头的没有变色,只有以"#-"开头的变色。

我用的是360极速浏览器chrome的内核。代码如下。

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Attribute</title>

<style type="text/css">

a[href]{

text-decoration: none;

}


a[href|="#"]{

color: #f0f;

}

</style>

</head>

<body>

<a href="attribute.html">attribute</a>

<a href="#">attribute</a>

<a class="one two" href="#1">attribute</a>

<a class="two three" href="#2">attribute</a>

<a href="#3">attribute</a>

<a href="#4">attribute</a>

<a href="#5">attribute</a>

<a href="#6">attribute</a>


<a href="3#">attribute</a>

<a href="4#">attribute</a>

<a href="5#">attribute</a>

<a href="6#">attribute</a>


<a href="3#3">attribute</a>

<a href="4#4">attribute</a>

<a href="5#5">attribute</a>

<a href="6#6">attribute</a>


<a href="#-3">attribute</a>

<a href="#-4">attribute</a>

<a href="#-5">attribute</a>

<a href="#-6">attribute</a>

</body>

</html>


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

2回答
weibo_罗俊贤__03449742 2017-03-09 21:03:49

[href|="#"]是包含只有#或#-开头的会变色

EnterSendman 2017-02-23 15:57:49

[href|="#"]  你这么写就是以#-开头的变色啊  你没好好听课啊  [href^="#"] 这么写才是以#开头的

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师