Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,158,315 members, 7,836,369 topics. Date: Wednesday, 22 May 2024 at 06:21 AM

Making Your Background Logo Image Clckable - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Making Your Background Logo Image Clckable (668 Views)

Nairaland's New Background And Layout Style / How Do I Randomly Change Background Image Of My Pages / Changing Css Or Background Based On Time (2) (3) (4)

(1) (Reply) (Go Down)

Making Your Background Logo Image Clckable by yawatide(f): 10:43pm On Feb 12, 2009
Between personal runs and moderating this board, it has been very busy for me and so I haven't been able to post lessons and quizzes. I managed to squeeze a few minutes out today and so, here it goes:

If you are like me and use CSS for layout, you probably add your logo as a background image, as opposed to embedding the logo on the page via the IMG tag. Going the CSS route has the advantage of reducing html code on your pages, among others.

If you are also like me, then you are probably frustrated that if you go the CSS background image route, you can't make your logos clickable, which is something that is good from a user experience standpoint.

Here is some nifty code I found that you may also find useful:

given the following code:

//html tags, etc go here

<style>
#header { width:990px; height:124px; background:url(/images/logo.jpg) no-repeat;}
</style>

//html tags go here
<div id="container">
<div id="header"></div>
</div>

You can make that logo.jpg clickable by adding a faux-link by modifying the code above like so:

//html tags, etc go here

<style>

#header { position: relative; width:990px; height:124px; background:url(/new-images/header.jpg) no-repeat; }
#header a { position: absolute; top: 0; left: 0; width:990px; height:124px; }
#header h1#header-link { display: none; }
</style>

//html tags go here
<div id="container">
<div id="header">
<a href="/" title="Home"><h1 id="header-link">Click to go back to home page</h1></a>
</div>
</div>

NOTE:
1) the #header a declaration has the same width and height with #header
2) the H1 within the #header A tag is set to display: none;

Try it out and if you can't get the above to work, post your questions here.

Here's to hoping we have all learned something from this. Hopefully, I will have some more time to devote to more such lessons.
Re: Making Your Background Logo Image Clckable by Nobody: 1:38am On Feb 13, 2009
Nice job and professional - crossbrowser too - and will work even when javascript is turned off!
Re: Making Your Background Logo Image Clckable by yawatide(f): 3:35am On Feb 13, 2009
yep dhtml,

Everything doesn't have to boil down to javascript cool
Re: Making Your Background Logo Image Clckable by Nobody: 4:06am On Feb 13, 2009
It seems ppl have labelled me with javascript on this forum and i am far better with php compared to javascript - i will have to do something about that very soon - i must redeem my image.
Re: Making Your Background Logo Image Clckable by yawatide(f): 12:17pm On Feb 13, 2009
dhtml,

It's called "typecasting". It's like seeing Nkem Owoh in a romantic movie. Having been typecast as a comedian, if you are like me, you probably won't watch such a movie. Likewise, you have typecast yourself as a javascript developer.

What will help you will be more than what even izal has to offer tongue

You probably need to lay low for while. For one though, as long as your tutorials proliferate (and I am not saying there is anything wrong with them), it only solidifies the typecasting wink
Re: Making Your Background Logo Image Clckable by quadrillio(m): 1:13pm On Feb 13, 2009
@yawa-ti-de

I are a darling grin LOL
Re: Making Your Background Logo Image Clckable by Nobody: 10:43pm On Feb 13, 2009
I am working on recasting myself - i will post something else soonest.
Re: Making Your Background Logo Image Clckable by efeboy(m): 12:04pm On Feb 19, 2009
@yawa-ti-de,

You are blessed.

Please make una dey continue to dey bless us.

How i wish i can get all this tricks done without so much complications and additional languages.


Thanks once more. More grease to your elbow.

(1) (Reply)

The Importance Of A Website / Wanted:: If You Can Do Animation, There Is A Job For You / Public Service Announcement On Scam Run By Hl Direct Marketing Trend Forex 2.0

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.