Skip to content

其他属性

图标属性

HTML 页面添加图标的最简单方法是使用图标库,可以将指定的图标类的名称添加到任何行内 HTML 元素,图标库中的所有图标都是可缩放矢量,可以使用 CSS进行自定义

css
/*如需使用相关图标,请在 HTML 页面的 <head> 部分内添加<link>标签*/
<!DOCTYPE html>
<html>
<head>
/*Bootstrap 图标*/
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
/*Google 图标*/
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<i class="glyphicon glyphicon-cloud"></i>
</body>
</html>

链接属性

链接可以使用任何 CSS 属性(例如 colorfont-familybackground 等)来设置样式,也可以根据链接处于什么状态来设置链接的不同样式,四种链接状态分别是:

  • a:link - 正常的,未访问的链接
  • a:visited - 用户访问过的链接
  • a:hover - 用户将鼠标悬停在链接上时
  • a:active - 链接被点击时
css
/* 未被访问的链接 */
a:link {
  color: red;
}

如果为多个链接状态设置样式,请遵循如下顺序规则:

  • a:hover 必须a:link a:visited 之后
  • a:active 必须在 a:hover 之后

相关属性:

属性描述
color设置链接字体颜色
text-decoration主要用于从链接中删除下划线,text-decoration: none;
background-color指定链接的背景色

Released under the MIT License.