首页htmlaHTML Element Style - 如何通过CSS属性选择器来定义各种锚类型

HTML Element Style - 如何通过CSS属性选择器来定义各种锚类型

我们想知道如何通过CSS属性选择器来定义各种锚类型。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
a {
  display: block
}

a[href^="tel"] {
  color: red;
}

a[href^="mailto"] {
  color: green;
}
</style>
</head>
<body>
  <a href="http://google.com">Google</a>
  <a href="tel:0123456789"> Call 0123456789</a>
  <a href="mailto:admin@google.com"> Mail Admin at Google</a>
</body>
</html>