将鼠标悬停在部分中的span标签上时,如何调出div框?

神奇骑士

我试图弄清楚如何将鼠标悬停在一个span标签上,然后调出一个自定义的div框?现在,我将span标签归因于title,它将自动悬停并解释它的含义,但是我不希望浏览器使用默认的标签,而是希望使用我自己的div“ define_box”我将鼠标悬停在span标签上时进行显示。我该怎么做呢?

我的完整代码在这里:http//jsfiddle.net/TheAmazingKnight/Mu2TS/

我的CSS代码的重点在这里:

#message > span:hover{

}
.define_box{ /*a definition box appears when hovered*/
height:100px;
width:500px;
background-color:#000;
color:#FFFE41;
font-weight:bold;
border: 1px solid #FFFE41;
/*z-index:-14;*/
display:none; /*hide the element until hovered*/
}

HTML:

拍照手机

            <p id="message">The first camera phone known as the J-Phone was sold in 2000 in Japan. The first generations of camera phones used 
            <span style="cursor:help;text-decoration:underline;" title="Charge Coupled Device is a light-sensitive integrated circuit that stores and displays the data for an image in such a way that each pixel (picture element) in the image is converted into an electrical charge the intensity of which is related to a color in the color spectrum. (techtarget)">Charge Coupled Device (CCD)</span>. Today, about 90% of 
            camera phones use <span style="cursor:help;text-decoration:underline;" title="Complementary metal-oxide-semiconductor is the semiconductor technology used in transistors. In a complementary way, it forms an effective means of electrical control. CMOS transistors uses less power when not needed. However, it does become hot when rapid direction changes are being used such as taking a snapshot. (techtarget)">Complementarymetal-oxide-semiconductor (CMOS)</span> 
            image sensor technology that improves somewhat over CCD by using way less power enhancing battery life, 
            less expensive to produce, but slightly lower in quality and resolution than CCDs. In 1997, Philippe Kahn pictures of his daughter&rsquo;s birth were
            the first known publicly shared pictures via a cell phone device to his families and friends. In 2003, more camera phones were being sold 
            worldwide than digital cameras. By 2006, more than half of mobile phones had a built-in camera. In 2010, the number of camera phones worldwide
            totaled to more than a billion. In 2012, Nokia announced the Nokia 808 PureView featuring 41-megapixel 1/1.2-inch sensor running Nokia&rsquo;s 
            Symbian OS. In 2013, the Nokia Lumia 1020, an improved version of the 41-megapixel sensor sports a 2/2-inch sensor, running Windows Phone 8, 
            achieved higher definition and light sensitivity.</p>

            <div class="define_box">
                Charge Coupled Device is a light-sensitive integrated circuit that stores and displays the data for an image in such a way that each pixel (picture element) in the image is converted into an electrical charge the intensity of which is related to a color in the color spectrum. (techtarget)
            </div>

            <div class="define_box">
                Complementary metal-oxide-semiconductor is the semiconductor technology used in transistors. In a complementary way, it forms an effective means of electrical control. CMOS transistors uses less power when not needed. However, it does become hot when rapid direction changes are being used such as taking a snapshot. (techtarget)
            </div>

            <!--<p id="message2"></p>-->
        </section> 
罗比·维克兹(Robbie Wxyz)

如果您的重组HTML这样定义div小号中目标后立即spanS,您可以使用CSS下一兄弟选择,+并展示div了当span被徘徊。

新的HTML:

Bla Bla Bla <span class="hard-word">Charge Coupled Device (CCD)</span><div class="definition">They are Bla Bla Bla</div> Bla Bla Bla<span class="hard-word">Another Term</span><div class="definition">They are Blip Blip Blip</div>

新CSS:

.definition{
    display: none;
    position: absolute;
    /* other styles */
}
.hard-word:hover + .definition{
    display: block;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

将鼠标悬停在div上,同时将鼠标悬停在整个标签上

来自分类Dev

将鼠标悬停在其中的标签上时如何更改 <li> 项目符号图标?

来自分类Dev

当我将鼠标悬停在chrome标签上时,是否可以禁用此文本框?

来自分类Dev

当用户第一次将鼠标悬停在标签上时,如何从字段集标签中删除css样式?

来自分类Dev

当我将鼠标悬停在标签上时,列表正在移动

来自分类Dev

鼠标悬停在<div>中时如何显示图像?

来自分类Dev

将鼠标悬停在其他元素上时,如何在span标签内显示文本?

来自分类Dev

将鼠标悬停在锚标签内的图像上且锚标签位于div内时,如何使文本显示?

来自分类Dev

将鼠标悬停在标签“ li”上时,JSTree显示div

来自分类Dev

将鼠标悬停在图像上时更改div标签内的文本?

来自分类Dev

将鼠标悬停在标签“ li”上时,JSTree显示div

来自分类Dev

鼠标悬停在栏上时如何显示标签

来自分类Dev

当我仍将鼠标悬停在标签上时,会发生onmouseout事件

来自分类Dev

将鼠标悬停在输入标签上不起作用

来自分类Dev

将鼠标悬停在h3标签上不起作用

来自分类Dev

将鼠标悬停在WPF中的按钮上时如何显示自定义文本框

来自分类Dev

当我将鼠标悬停在框上时,如何为框中的所有元素设置动画?

来自分类Dev

将鼠标悬停在数据上时如何显示数据标签

来自分类Dev

将鼠标悬停在li上时,如何使aa标签下划线

来自分类Dev

将鼠标悬停在控件上而不使用事件时,在标签中显示文本

来自分类Dev

将鼠标悬停在图像上时,如何在图像下放置消息?(部分完成)

来自分类Dev

将鼠标悬停在div上时如何更改div内的图像

来自分类Dev

将鼠标悬停在另一个div上时如何显示div

来自分类Dev

当用户将鼠标悬停在它上面时,如何使 div 与周围的 div 重叠?

来自分类Dev

将鼠标悬停在单词上时在框中显示文本

来自分类Dev

当我将鼠标悬停在文本框中时显示日历

来自分类Dev

将鼠标悬停在数据表中的图标上时显示弹出框

来自分类Dev

将鼠标悬停在CSS中的列表项上时如何触发div可见性?

来自分类Dev

将鼠标悬停在用 javascript 创建的 div 中

Related 相关文章

  1. 1

    将鼠标悬停在div上,同时将鼠标悬停在整个标签上

  2. 2

    将鼠标悬停在其中的标签上时如何更改 <li> 项目符号图标?

  3. 3

    当我将鼠标悬停在chrome标签上时,是否可以禁用此文本框?

  4. 4

    当用户第一次将鼠标悬停在标签上时,如何从字段集标签中删除css样式?

  5. 5

    当我将鼠标悬停在标签上时,列表正在移动

  6. 6

    鼠标悬停在<div>中时如何显示图像?

  7. 7

    将鼠标悬停在其他元素上时,如何在span标签内显示文本?

  8. 8

    将鼠标悬停在锚标签内的图像上且锚标签位于div内时,如何使文本显示?

  9. 9

    将鼠标悬停在标签“ li”上时,JSTree显示div

  10. 10

    将鼠标悬停在图像上时更改div标签内的文本?

  11. 11

    将鼠标悬停在标签“ li”上时,JSTree显示div

  12. 12

    鼠标悬停在栏上时如何显示标签

  13. 13

    当我仍将鼠标悬停在标签上时,会发生onmouseout事件

  14. 14

    将鼠标悬停在输入标签上不起作用

  15. 15

    将鼠标悬停在h3标签上不起作用

  16. 16

    将鼠标悬停在WPF中的按钮上时如何显示自定义文本框

  17. 17

    当我将鼠标悬停在框上时,如何为框中的所有元素设置动画?

  18. 18

    将鼠标悬停在数据上时如何显示数据标签

  19. 19

    将鼠标悬停在li上时,如何使aa标签下划线

  20. 20

    将鼠标悬停在控件上而不使用事件时,在标签中显示文本

  21. 21

    将鼠标悬停在图像上时,如何在图像下放置消息?(部分完成)

  22. 22

    将鼠标悬停在div上时如何更改div内的图像

  23. 23

    将鼠标悬停在另一个div上时如何显示div

  24. 24

    当用户将鼠标悬停在它上面时,如何使 div 与周围的 div 重叠?

  25. 25

    将鼠标悬停在单词上时在框中显示文本

  26. 26

    当我将鼠标悬停在文本框中时显示日历

  27. 27

    将鼠标悬停在数据表中的图标上时显示弹出框

  28. 28

    将鼠标悬停在CSS中的列表项上时如何触发div可见性?

  29. 29

    将鼠标悬停在用 javascript 创建的 div 中

热门标签

归档