By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,435 Members | 2,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,435 IT Pros & Developers. It's quick & easy.

Making a background image a working link

P: n/a
I'm using a stylesheet to place a small 'background image' in the
upper left corner of several pages. Is there a simple way of making
that image a clickable link? Thanks.
Jul 20 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
Jeff Gillingham wrote on 30 nov 2003 in
comp.infosystems.www.authoring.stylesheets:
I'm using a stylesheet to place a small 'background image' in the
upper left corner of several pages. Is there a simple way of making
that image a clickable link? Thanks.


A background image is not clickable, onmy html-elements are clickable and
if the background image is a style of the body, only the body is.

However you can make a position absolute transparent div with a z-index of
say 9999 overlaying the bg img and all other elements and make that
clickable:
<body style="background-image:url('myimage.gif');
background-repeat:no-repeat;background-position:left top;">
<div
style="position:absolute;left:0;top:0;z-index:9999;
background-color:transparent;width:350px;height:250px;"
onclick ="whatever()">&nbsp;</div>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2

P: n/a
Jeff Gillingham wrote:
I'm using a stylesheet to place a small 'background image' in the
upper left corner of several pages. Is there a simple way of making
that image a clickable link?


If its clickable then it should be a foreground image with suitable
alternative text. Backgrounds are for presentation only.
Jul 20 '05 #3

P: n/a
Evertjan. wrote:
Jeff Gillingham wrote on 30 nov 2003 in
comp.infosystems.www.authoring.stylesheets:

I'm using a stylesheet to place a small 'background image' in the
upper left corner of several pages. Is there a simple way of making
that image a clickable link? Thanks.

A background image is not clickable, onmy html-elements are clickable and
if the background image is a style of the body, only the body is.

However you can make a position absolute transparent div with a z-index of
say 9999 overlaying the bg img and all other elements and make that
clickable:
<body style="background-image:url('myimage.gif');
background-repeat:no-repeat;background-position:left top;">
<div
style="position:absolute;left:0;top:0;z-index:9999;
background-color:transparent;width:350px;height:250px;"
onclick ="whatever()">&nbsp;</div>

quite clever.

--
Bill Drescher
bill {at} TechServSys {dot} com

Jul 20 '05 #4

P: n/a
bill drescher wrote:
A background image is not clickable, onmy html-elements are clickable and
if the background image is a style of the body, only the body is.

However you can make a position absolute transparent div with a z-index
of say 9999 overlaying the bg img and all other elements and make that
clickable:
quite clever.


Until you try using it in a browser which does not support, or has turned
off, either images, CSS or both.
Jul 20 '05 #5

P: n/a
David Dorward wrote on 01 dec 2003 in
comp.infosystems.www.authoring.stylesheets:
quite clever.


Until you try using it in a browser which does not support, or has
turned off, either images, CSS or both.


I do not think it was that clever, but the cleverness of a code does not
change if you try that.

btw:

It is damn stupid to try that without accepting that it hurts your
functionality. Try to look at such a page with the computer turned off.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #6

P: n/a
Evertjan. wrote:
David Dorward wrote on 01 dec 2003 in
comp.infosystems.www.authoring.stylesheets:
Until you try using it in a browser which does not support, or has
turned off, either images, CSS or both.


btw:

It is damn stupid to try that without accepting that it hurts your
functionality. Try to look at such a page with the computer turned off.


Is it damn stupid to browse with Lynx? Is Googlebot damn stupid to
spider the www?

--
Brian
follow the directions in my address to email me

Jul 20 '05 #7

P: n/a
Brian wrote on 01 dec 2003 in comp.infosystems.www.authoring.stylesheets:
Evertjan. wrote:
David Dorward wrote on 01 dec 2003 in
comp.infosystems.www.authoring.stylesheets:
Until you try using it in a browser which does not support, or has
turned off, either images, CSS or both.
btw:

It is damn stupid to try that without accepting that it hurts your
functionality. Try to look at such a page with the computer turned off.


Is it damn stupid to browse with Lynx?


No, not at all, but I repeat, it is damn stupid to browse with Lynx AND not
accepting the limitations of that.
Is Googlebot damn stupid to spider the www?


Sorry, I don't see the connection. Googlebot only does as it is told.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #8

P: n/a
Evertjan. wrote:
Brian wrote on 01 dec 2003 in comp.infosystems.www.authoring.stylesheets:
Evertjan. wrote:
David Dorward wrote on 01 dec 2003 in
comp.infosystems.www.authoring.stylesheets:

Until you try using it in a browser which does not support, or has
turned off, either images, CSS or both.
It is damn stupid to try that without accepting that it hurts your
functionality. Try to look at such a page with the computer turned off.


Is it damn stupid to browse with Lynx?


No, not at all, but I repeat, it is damn stupid to browse with Lynx AND not
accepting the limitations of that.


The only limitation of Lynx relevant to this discussion is the
inability to display the images inline. Lynx has absolutely no
deficiency when it comes to linking to other resources. That includes
linking images, which Lynx displays either using a placeholder, or the
alt text. A properly authored page would, of course, have alt text
anytime an image is important enough to be linked.

A solution which relies on image loading and css will fail when
browsed by Lynx. A solution that relies instead on floating the
image, and making that a hyperlink, will not fail in Lynx. And it
will work in Mozilla, Opera, et. al., too.
Is Googlebot damn stupid to spider the www?


Sorry, I don't see the connection. Googlebot only does as it is told.


Googlebot does not load images and does not process css. (It also
does not have js, but that's another story.) If a person is "damn
stupid" to browse that way, then I wonder if Googlebot is similarly
deficient.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #9

P: n/a
Evertjan. wrote:
Until you try using it in a browser which does not support, or has
turned off, either images, CSS or both.
It is damn stupid to try that without accepting that it hurts your
functionality.


Do what? Using a browser with out images and/or CSS support?

Plenty of people disable images - especially among those who pay for
bandwidth by data transfered rather then a flat or per $time-period rate.

Plenty of people have disabilities that make them dependent on alt text to
understand images.

Increasing numbers of people are using hand held devices to access the
Internet - and they tend towards having tiny screens and poor CSS support -
both factors that would make the technique being described useless to them.

One of the great things about the web is that webpages (IF the right tool is
used for the right job) is that if you have a flash system (and are
physically capable of using the technologies), you can get pretty, highly
interactive content. If you _don't_ then you can discard layers until you
get to the bits you can enjoy.

Content is king.

Lynx may have its limitations, but if the page is written properly then all
the content will be accessible.

(Insert usual exceptions for movies, gallery sites, and interactive game
applets noting that even in those cases a well written site will still
allow the user to navigate and download content lynx can't display
natively)

--
David Dorward <http://dorward.me.uk/>

Jul 20 '05 #10

P: n/a
Brian wrote on 02 dec 2003 in comp.infosystems.www.authoring.stylesheets:
A solution that relies instead on floating the
image, and making that a hyperlink


Ho ho,

The OQ was not about an hyperlink, just about clickability.

The result of the click is the execution of a javascript [or other] code.

This code could have all kinds of effects not available in Lynks.

But all this is OT [not the OQ], clicking is not part of CSS.

[btw: my longtime experience with Lynx ended in 1996.]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #11

P: n/a
On Tue, 2 Dec 2003, Evertjan. wrote:
Brian wrote on 02 dec 2003 in comp.infosystems.www.authoring.stylesheets:
A solution that relies instead on floating the
image, and making that a hyperlink
Ho ho,

The OQ was not about an hyperlink, just about clickability.

The result of the click is the execution of a javascript [or other] code.


Or not, depending on the browsing situation. If you're using such
potentially risky techniques in the first place, I'm not sure why
you'd be so keen to add yet more risk factors to them. Making a
useful web page is often about knowing what to leave out, rather than
trying to shovel-in every kind of technology that one can get hold of.
[btw: my longtime experience with Lynx ended in 1996.]


Was that a boast or an apology?

Then maybe you'd do better to defer to those who have at least some
familiarity with its current versions, rather than trying to pour
scorn on their contributions to the discussion.

Jul 20 '05 #12

P: n/a
Evertjan. wrote:
David Dorward wrote on 01 dec 2003 in
comp.infosystems.www.authoring.stylesheets:
quite clever.
Until you try using it in a browser which does not support, or has
turned off, either images, CSS or both.

....
It is damn stupid to try that without accepting that it hurts your
functionality. Try to look at such a page with the computer turned off.

I tried that, and you are right, it did not bring up the page. I guess
that it is reasonable to assume that most folk will have their computer
on and css enabled to see this site. But, the author will have to
accept that he will lose the traffic of those who have css turned off,
images turned off, or their computers turned off.

--
Bill Drescher
bill {at} TechServSys {dot} com

Jul 20 '05 #13

P: n/a
*bill drescher* <no****@Spamcop.net>:

I guess that it is reasonable to assume that most folk will have their
computer on and css enabled to see this site. But, the author will have to
accept that he will lose the traffic of those who have css turned off,
images turned off, or their computers turned off.


Don't forget people with user stylesheets. Some may have (probably one of
the most common UCSS rulesets):

body {background: white !important; color: black !important}

they'll not see the image, but the area would be clickable. Others may hate
fixed positioning and thus specified

* {position: static !important},

because you can't disable only 'position: fixed'. They'll see the image, but
it won't be clickable.

--
If the glass is half full or half empty
depends on if you are pouring or drinking.
Jul 20 '05 #14

P: n/a

I was trying to do something similar. Here's a mickey mouse workaroun
that will do the trick.

Create a transparent graphic in Illustrator or any other graphic
program you have, make sure to save it as GIF.

Dreamweaver lets you make DIV layers easily. Create one over the imag
you're trying to link. Insert your transparent gif and add the url t
it. That's it.

Cheesy. I know, but it works

Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message17557.htm

Jul 20 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.