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

 

 

  Quote

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.....

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.