Tutorials Forums
     Tutorials Videos
        Sign Up Now For FREE
Welcome, Guest
Username Password: Remember me

Image Rollovers
(1 viewing) (1) Guest
HTML HELP, HTML TUTORIALS, HTML PROGRAMMING, HTML CODE, HTML DESIGN

Hypertext Markup Language (HTML) is the authoring software language used for building web pages. It is a subset of Standard Generalized Markup Language (SGML). In HTML, a block of text is often surrounded by tags that indicate how a browser should display it. There’s much more to HTML than that, of course, as the articles in this section detail.
  • Page:
  • 1

TOPIC: Image Rollovers

Image Rollovers 01 Dec 2009 08:38 #29

All right, this tutorial is short and sweet but rather effective.
First you will need two different images to transition between; however, in CSS's case put them side-by-side and save it as the same single image , and it should be uploaded along with the rest of your site in the same directory as the html file.

<a href="link location" class="rollover" title="link"><span class="displace">Link</span></a>


This creates a link that if CSS is enabled will make the rollover button, and if CSS is disabled, then it creates a very simple link to the same place.


a.rollover {
display: block;
width: width/2px;
height: height/2px;
text-decoration: none;
background: url("img1.png");
}

a.rollover:hover {
background-position: -150px 0;
}

.displace {
position: absolute;
Wherever you want the image
}


All we do is we set the button to only display the first half of the button until the user rolls over it with the mouse and then it displays only the second half.
  • CE
  • OFFLINE
  • Administrator
  • Posts: 197
  • Karma: 78
CodersEngine
  • Page:
  • 1
Time to create page: 0.22 seconds