Link to home
Start Free TrialLog in
Avatar of glynn19872000
glynn19872000

asked on

css submit button image keeps disappearing on first hover!

i have just made a button for my form and log in.
the button is two images which i change change with css :hover
however when loading the page, the first few times of hovering over my button the image completely disappears. Is there a way to ensure that the image will be replaced on the first time because i cant accept it jst disappearing how it does.

and example can be found at the website i am trying to make:
www.manchestermusicscene.co.uk
(the login system and form dont actually do anything yet it is merely a template)

here is a snippet of the css i use for each button and the corresponding html

#top p input.login{
      width:48px;
      height:19px;
      background-color:transparent;
    background-image:url(layout_images/login.jpg);
      border:none;
      }
      
#top p input.login:hover{
    background-image:url(layout_images/loginhover.jpg);
      }

<p><input type="submit" class="login" name="login" value="" /></p>

#bodycontent input.submit {
      width:74px;
      height:26px;
      background-color:transparent;
    background-image:url(layout_images/signup.jpg);
      border:none;
      }
      
#bodycontent input.submit:hover {
    background-image:url(layout_images/signuphover.jpg);
      }

<p><input type="submit" class="submit" name="submit" value="" /></p>


Thankyou
Avatar of kingsburymedia
kingsburymedia
Flag of Canada image

Sounds like ie flicker to me. Try preloading the :hover images.
If you were visiting the page for the first time, so that the images is not cached in your browser yet, the current image disappears but the image that should be swapped with doesn't show up.
That's happening because the images havent loaded yet.
The simplest way to get iver this is to confine your rollover effects to the CSS-styled text and use the same button face image for all of the rollover states. This gives you fast, clean rollover effects, but it somewhat limits your design options.
OR you could pre-load the images. The problem is that preloading images adds to the time it takes for the page to load and appear in the visitor's browser
Perhaps the best way is to combine your graphics into one image file like this: http://builder.com.com/i/tr/techmails/Figure2.jpg.
Then change the position of the graphic with CSS.
Take a look at this example, the underlying CSS code is in View Source!
http://www.meadhra.com/cnet/040128/Button_Sample.html

Avatar of glynn19872000
glynn19872000

ASKER

thankyou, i found this and it solved the problem!

http://www.netmechanic.com/news/vol6/css_no18.htm
ASKER CERTIFIED SOLUTION
Avatar of kingsburymedia
kingsburymedia
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial