+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Elite Designer GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ has a reputation beyond repute GoldenZ's Avatar
    Join Date
    Oct 2006
    City, State
    Alexandria
    Posts
    457

    Talking swap images using CSS not Java Script

    Hello All,
    Today i'm going to show you how to Swap images using Pure CSS Instead of Java-Script with Firefox and Internet explorer comparability.

    Basically most of us started using FrontPage, and they end with Dreamweaver, thats what i'm since using 5 years.


    Swap Images:
    This is a replacement of the Swap image in Dreamweaver using a Java Script code which can cause an error to some ppl.

    To-do that, You need to do the following:

    Create a Div in your Favorite editor and call it whatever you want ex. Box

    Code:
    <div class="box"><a href="#"></a></div>
    in this method i will not place the image on the div as insert image, but i will embed the image in the a href as a background.

    Code:
    .box a {
    	display: block;
    	background-position: 0px 0px;
    	background-image: url(img1.jpg);
    	height: 300px;
    	width: 300px;
    }
    It is SO IMPORTANT to give the a href class a Block display, else the hover won't work.

    and the a:hover class will be the 2nd image you want to show when mouse over

    Code:
    .box a:hover {
    	background-image: url(img2.jpg);
    	background-repeat: no-repeat;
    	background-position: 0px 0px;
    	height: 300px;
    	width: 300px;
    }
    Thats it. works with firefox and internet explorer all versions.

    View it Live here
    Source Code at the Attachment

    Regards,
    -Amr
    Attached Files

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Follow us on
Become a fan
Subscribe to our feeds
Circle us

© 2012 DesignContest.com
(Formerly DesignContest.net)

Use of this website by both contest holders and designers is subject to acceptance of our Terms of Services and Privacy Policy.
feedback