Make background image a link?

P

paul j

Is this possible?

I have a large graphic as a header image which I would like to make
"clickable" so that visitors can return to the main page but I can't figure
out how.

Any thoughts?
 
N

Neal

Is this possible?

I have a large graphic as a header image which I would like to make
"clickable" so that visitors can return to the main page but I can't
figure
out how.

Is it background or content? Pick one. Content can be clickable.
Background can't.
 
P

paul j

Is it background or content? Pick one. Content can be clickable.
Background can't.

..topleft {
background-image: url(topleft.jpg);
width: 847px;
height: 204px;
}

[---]

<div class="topleft"></div>
 
M

mbstevens

paul said:
Is this possible?

I have a large graphic as a header image which I would like to make
"clickable" so that visitors can return to the main page but I can't
figure out how.

Any thoughts?

You can *approximate* the effect you *might* want by using the z-index.

A large foreground image can be placed on <body> and all other content
placed in objects that are above it in the z-index. Google z-index to
learn particulars.
 
J

Jeffrey Silverman

.topleft {
background-image: url(topleft.jpg);
width: 847px;
height: 204px;
}

[---]

<div class="topleft"></div>

Try this.

Add "display:block" to the css definition

Change <div class="topleft"></div>

to

<a class="topleft"></a>


later...
 
P

paul j

.topleft {
background-image: url(topleft.jpg);
width: 847px;
height: 204px;
}

[---]

<div class="topleft"></div>

Try this.

Add "display:block" to the css definition

Change <div class="topleft"></div>

to

<a class="topleft"></a>


later...

That works, but it isn't clickable...adding "href" to it causes it to fail
validation.
 
K

Kris

<11v6tufyi0whn$.dlg@P7Ax8zefAz8re8ranuGa9rebruMUdruPHeYaPrabru9haSE5r56r
eThufrufRu4p.org>,
paul j said:
That works, but it isn't clickable...adding "href" to it causes it to fail
validation.

How will visitors without the ability to see images be able to use your
site?
 
P

paul j

<11v6tufyi0whn$.dlg@P7Ax8zefAz8re8ranuGa9rebruMUdruPHeYaPrabru9haSE5r56r
eThufrufRu4p.org>,


How will visitors without the ability to see images be able to use your
site?

Making an image a link renders the site unnavigable?
 
K

Kris

<6xvtadh6k2up$.dlg@P7Ax8zefAz8re8ranuGa9rebruMUdruPHeYaPrabru9haSE5r56re
ThufrufRu4p.org>,
paul j said:
Making an image a link renders the site unnavigable?

No. When using an appropriate alternative text on the image, those users
are catered for. However, how would you set an alternative text on a
background image?
 
N

Neal

paul said:
.topleft {
background-image: url(topleft.jpg);
width: 847px;
height: 204px;
}

[---]

<div class="topleft"></div>

To have a link, you need two things. An anchor, and content to click.
Right now you have neither.

Within the div you should include an anchor link, and then the image you
want clicked as the content. Or, if you really have to have it in the
background, use a transparent image in the content, same size as your div
(margin:0;padding:0; as well). In either case, the image's alt value
will be what you want no-image users to encounter as link text.

Try something like this, not tested (and BTW "topleft" is cruddy style.
I'll use "logo" because that's what this is):

CSS

..logo {
background-image: url(topleft.jpg);
width: 847px;
height: 204px;
}

..logo a img {
margin: 0;
padding: 0;
}

And HTML

<div class="logo">
<a href="index.html">
<img src="transparent.png" height="204" width="847" alt="Logo Text Goes
Here">
</a>
</div>
 
S

Starshine Moonbeam

<cqgm8dr9t0hq.dlg@P7Ax8zefAz8re8ranuGa9rebruMUdruPHeYaPrabru9haSE5r56reT
hufrufRu4p.org>, paul j ([email protected]) dropped a +5 bundle
of words...
Is this possible?

Not with a background image.
I have a large graphic as a header image which I would like to make
"clickable" so that visitors can return to the main page but I can't figure
out how.

Any thoughts?

<a href="yourpage.html"><img src="yourpic.gif"/></a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top