naveenbj Posted June 9, 2008 Share Posted June 9, 2008 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 More sharing options...
pquery Posted June 9, 2008 Share Posted June 9, 2008 add an <a> to your non breaking space ie: <div id="header"> <a href="link.php"> </a> </div> (you might want to add more then one space to make a bigger clickable area Link to comment https://forums.phpfreaks.com/topic/109381-how-to-link-background-image-from-css/#findComment-561199 Share on other sites More sharing options...
linstefoo Posted June 10, 2008 Share Posted June 10, 2008 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 https://forums.phpfreaks.com/topic/109381-how-to-link-background-image-from-css/#findComment-561733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.