Jump to content

How to link background image from CSS


naveenbj

Recommended Posts

Hi

 

Here is what im looking for-->

 

In my page the logo is coming from CSS as a background-image but im not able to make ot hyperlink so can any one help.

 

Here is the code

in page-->

<div id="header">  </div>

 

in CSS file-->

#header {
float: left;
padding: 0px;
margin-right: 2px;
width: 294px;
height: 81px;
background: url(../images/index_01.jpg) no-repeat;

 

I hope i described well but if any doubt on question plz let me kno .

 

Regards,

Nj

Link to comment
Share on other sites

Another way that I use is to link the 'a' to the style like so:

#header a
{
     display: block;
     margin: 0 2px 0 0;
     padding: 0;
     width: 294px;
     height: 81px;
     background: url(../images/index_01.jpg) no-repeat;
     float: left;
}

 

Then to initiate it in code, do this:

<div id="header">

  <a href="link.php">Link</a>

  <!-- Doing it this way allows text based browsers -->

  <!-- and disabilities enabled browsers to read this graphic -->

</div>

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.