我想在 <a>
中创建嵌套链接标签
例子:
<a href="#">This is a link <a id="sup">sup text</a> end of the link</a>
CSS:
a#sup{
color:#19578e;
font-family: Verdana;
font-size: 8pt;
vertical-align: top;
}
a {
font-family: Arial;
color: #19578e;
font-size: 10pt;
font-weight: normal;
font-style: normal;
text-decoration: none;
}
但是,像这样只有“This is a link”指向链接...
最佳答案
使用 SPAN,因为您不能嵌套 anchor 标记。
<a href="#">This is a link <span id="sup">sup text</span> end of the link</a>
Ok I'll use span, but how to make the span having the same propreties than anchor tag when anchor tag is hover ?
将悬停状态添加到“sup”元素的 CSS。
a, a:hover #sup {
font-family: Arial;
color: #19578e;
font-size: 10pt;
font-weight: normal;
font-style: normal;
text-decoration: none;
}
如果你有更多的地方,你可以简单地使用:
a, a:hover span { ... }
关于CSS - 嵌套 anchor 标记链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20552611/