Buttons from images

You totally CAN make an image into a button that loads a new page without JavaScript.


The usual reason for wanting to make an image into a button without using the usual link tags, i.e.,


Here's an alternative to having to define a JavaScript function for the onclick event:

    


- or -


    
onClick="location.href='index.html'">





Apply attributes using CSS:


#clickhere {
    background-image: url('pathtoimage/image.png');
    height: 20px;
    width: 75px;
}

0 comments: