html中的a标签

    xiaoxiao2021-11-20  67

    a标签一般要链接到某个网址或其他文件,成对出现<a>...</a>默认格式为带下划线的链接。 如:<a>www.baidu.com</a>    显示结果为www.baidu.com。 a标签中的内容有未访问、悬浮时、点击时和已访问四种状态,可以使用css为不同状态设置不同的样式。 设置未访问:      a:link                     设置悬浮时:      a:hover                        设置点击时:      a:active                      设置已访问:      a:visited 其中下划线的样式可以设置成下划线、上划线、删除线和无装饰(去除默认的下划线) text-decoration:none 无装饰,去除默认下划线 text-decoration:underline 下划线样式 text-decoration:line-through 删除线样式-贯穿线样式 text-decoration:overline 上划线样式 若设置样式时不指定是哪种状态则默认为未访问时的样式,即给a设置样式的样式是未访问时的样式。

    eg:(body中设置一个a连接的class名为a1)

    <head> <style type="text/css"> #a1{ text-decoration: none; text-align: center; line-height: 50px; margin-top: -10px; border-bottom-width: 2px; border-bottom-style: solid; } #a1:link{ color: #ffffff; } #a1:visited{ color:#ffffff; } #a1:hover{ color: #fea729; } #a1:active{ color: #ff0000; } </style> </head>

    转载请注明原文地址: https://ju.6miu.com/read-678384.html

    最新回复(0)