Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member justlivyalife's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham, UK
    Posts
    2,871
    Member #
    2374
    Is there anyway I can allow a DIV to be a link. I have a DIV using the following code:
    Code:
    .linkhome { position: absolute; right: 10px; top: 10px; width: 30px;
    height: 200px; background: url(home.gif) no-repeat top left; }
    How would I call the DIV but allow the image to be a link to the page I want?

    How would you get the hand cursor on the link also?
    justlivyalife - The future depends on what we do in the present. (Mahatma Gandhi)
    WDF Resources: WDF Rules
    Non-WDF: JavascriptSource | Dynamic Drive | phpBB | HTML-Kit | Winamp | Download Firefox | Morguefile

  2.  

  3. #2
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    just have

    Code:
    <a href="where/you_want/to.go" target="_top">
    <div class="linkhome">&nbsp;</div>
    </a>
    and in your CSS remember to put the font-size to something like 5px; or something, because I think some random browsers ignore DIVS and stuff with nothing in, this way you can put a "&nbsp;" inside without the whole thing stretching up. If you get me... :S

    This mehtod is very common and used for instance in small squares (usually mistaken for images) indicating different colour schemes - e.g. KI'm not explaining this very well, am I? here: http://karinne.net has a colour-switcher, on the nav bar below the banner. those are div buttons, not images. :thumbsup:


    hope I helped.


    EDIT:
    how to get a hand cursor over the DIVs

    HTML:
    Code:
    <div class="linkhome">&nbsp;</div>
    CSS:
    Code:
    .linkhome { position: absolute; right: 10px; top: 10px; width: 30px;
    height: 200px; background: url(home.gif) no-repeat top left;
    cursor: hand;}
    note: don't bother with the :hover and :active etc. states, just leaving ti liek this gets them all and fi you try to do it with just :hover the cursor kind of flickers a bit in IE.

    there we go :thumbsup:
    tekp :cheeky: tekponline.com


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:22 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com