Display text on MouseOver for image in html

前端 未结 4 1850
春和景丽
春和景丽 2020-12-02 08:16

I would like to display text when the user mouseovers the image.

How can I do this in HTML/JS?

4条回答
  •  误落风尘
    2020-12-02 08:50

    You can use CSS hover in combination with an image background.

    CSS

       .image
    {
        background:url(images/back.png);
        height:100px;
        width:100px;
        display: block;
        float:left;
    }
    
    .image  a {
        display: none;
    }
    
    .image  a:hover {
        display: block;
    }
    

    HTML

    
    

提交回复
热议问题