小编典典

如何更改锚标记内title属性的样式?

html

例:

<a href="example.com" title="My site"> Link </a>

如何在浏览器中更改“标题”属性的显示方式?默认情况下,它只有黄色背景和小字体。我想将其放大并更改背景颜色。

是否有CSS样式来设置title属性?


阅读 364

收藏
2020-05-14

共1个答案

小编典典

这是一个如何做的例子:

a.tip {
    border-bottom: 1px dashed;
    text-decoration: none
}
a.tip:hover {
    cursor: help;
    position: relative
}
a.tip span {
    display: none
}
a.tip:hover span {
    border: #c0c0c0 1px dotted;
    padding: 5px 20px 5px 5px;
    display: block;
    z-index: 100;
    background: url(../images/status-info.png) #f0f0f0 no-repeat 100% 5%;
    left: 0px;
    margin: 10px;
    width: 250px;
    position: absolute;
    top: 10px;
    text-decoration: none
}
<a href="#" class="tip">Link<span>This is the CSS tooltip showing up when you mouse over the link</span></a>
2020-05-14