Jump to content

[SOLVED] HOWTO make a link inside a css file


rh-penguin

Recommended Posts

You want to use a CSS image as a link?

 

I believe you'd still need to use <a href within the code. CSS images are like html wallpaper - you can't click on them.

 

The following article talks about css rollovers and as you can see, you refer to the CSS in a div, but still need the <a href to actually make the link.

 

http://www.webcredible.co.uk/user-friendly-resources/css/rollover-buttons.shtml

 

 

Link to comment
Share on other sites

you refer to the CSS in a div, but still need the <a href to actually make the link.

I've did that but something dont seem to work right.

Okay.....

I've got a header.php. Inside theres a logo and a few other things(login, register LINKS etc.....).

My css for the logo is as following:

#logo {
background-image:url(images/logo.png);
width: 151px; 
height: 65px;
margin-top: 18px;
margin-left: 35px;
}

and then i display it with HTML like:

<a href="index.php"><div id="logo"></div></a>

I've specifid the width and height of the logo(as you can see) BUT when i go to view this in a browser and if i hover over the logo, instead of making ONLY the logo a link, the div take all the space to the right. So instead of the width being 151px(for the link) it makes it something like 800px.

Have i done something wrong?

I hope i didnt confuse you, i was getting confused my self.....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.