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
https://forums.phpfreaks.com/topic/109381-how-to-link-background-image-from-css/
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>

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.