<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.demo a{
float: left;
display: block;
height: 50px;
width: 50px;
border-radius: 10px;
background: #16ecec;
text-align: center;
color: grey;
margin-right: 5px;
font: bold 20px/50px Arial;
}
/*属性名, 属性名=属性值(正则)存在ID属性的元素
a[]{}格式
= 绝对等于
*= 包含等于
^= 以开头相同的
$= 以结尾的
*/
/*a[id]{*/
/* background: #61e93e;*/
/*}*/
/*a[id=first]{*/
/* background: yellow;*/
/*}*/
/*a[class*=links]{*/
/* background: #16ecec;*/
/*}*/
/*a[href^=http]{*/
/* background: red;*/
/*}*/
a[href$=pdf]{
background: #61e93e;
}
</style>
</head>
<body>
<p class="demo">
<a href="https://www.baidu.com" class="links item first" id="first">1</a>
<a href="https://www.lr.com" class="links item active" target="_blank" title="test">2</a>
<a href="images/tx.jpg" class="links item">3</a>
<a href="abc">4</a>
<a href="/a.pdf">5</a>
<a href="/abc.pdf">6</a>
<a href="abc.doc">8</a>
<a href="abcd.doc">9</a>
<a href="abcde.txt">10</a>
</p>
</body>
</html>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义