gpt4 book ai didi

html - 当用户将鼠标悬停在单词上时,如何显示标题?

转载 作者:太空宇宙 更新时间:2023-11-04 14:32:51 24 4
gpt4 key购买 nike

代码示例如下:

<p>Bob's <dfn title="Dog">canine</dfn> mother and <dfn title="Horse">equine</dfn> father sat him down and carefully explained that he was an <dfn title="A mutation that combines two or more sets of chromosomes from different species">allopolyploid</dfn> organism.</p>

如果用户将鼠标悬停在犬科动物 马科动物异源多倍体 上,我该如何做到这一点,我使用的标题然后可以向用户显示 dfn 标题,以便他知道每个更难的单词的意思?

最佳答案

只需使用标题作为 :after psuedo 的内容,然后在工具提示中显示它!

p {
margin: 60px auto;
}
dfn {
position: relative;
}
dfn:hover:after {
content: attr(title);
background: #fff;
padding: 5px 12px;
border: solid 1px #ddd;
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
}
<p>Bob's <dfn title="Dog">canine</dfn> mother and <dfn title="Horse">equine</dfn> father sat him down and carefully explained that he was an <dfn title="A mutation that combines two or more sets of chromosomes from different species">allopolyploid</dfn> organism.</p>

关于html - 当用户将鼠标悬停在单词上时,如何显示标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32372435/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com