DIV img -> hover text

Discussion in 'CSS' started by Cheszy, Oct 31, 2010.

  1. #1
    I know it is easy, but I can't find the codes anywhere...

    I have a DIV, with a background (or regular image).

    And I want when I hover it, I get a text IN the div, and without hover, you don't see the text.

    Please help me.
     
    Cheszy, Oct 31, 2010 IP
  2. karthimx

    karthimx Prominent Member

    Messages:
    4,959
    Likes Received:
    127
    Best Answers:
    2
    Trophy Points:
    340
    #2
    you can better add a image button

    where myimage.jpg is just a plain image and myimage_hover.jpg with text on it.

    a {
    background: url("images/myimage.jpg");
    }

    a: hover {
    background: url("images/myimage_hover.jpg");
    }
     
    karthimx, Nov 1, 2010 IP
  3. Layoutzzz

    Layoutzzz Greenhorn

    Messages:
    78
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #3
    karthimx
    +1

    but if you do not want to use image. You should use javascript(jQuery) for it.
     
    Layoutzzz, Nov 1, 2010 IP
  4. Cheszy

    Cheszy Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ok, I'm searching all over google but I can't find anything (I know it's me, but seriously, I can't find it!)
     
    Cheszy, Nov 1, 2010 IP
  5. Layoutzzz

    Layoutzzz Greenhorn

    Messages:
    78
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #5
    I have done it myself on jQuery.
    Please look at demo here

    Also I have attach source
    View attachment test.zip
     
    Layoutzzz, Nov 1, 2010 IP