hyperlink a positioned image?

A

abby

Please help,
Using CSS how can I position an image center/center on a page AND
hyperlink the image??
The following markup does not appear to allow for a hyperlink
<style type="text/css">
body
{
background-image:
url('smiley.gif');
background-repeat:
no-repeat;
background-position:
center;
}
</style>

Thank you!

(posted also in alt.html.critique)
 
S

Steve Pugh

abby said:
Using CSS how can I position an image center/center on a page AND
hyperlink the image??

img.foo {psoition: absolute; top: 50%; left: 50%; margin-top -100px;
margin-left: -100px;}

<a href="bar.html"><ing class="foo" src="foo.gif" alt="Foo Bar"
width="200" height="200"></a>

Change the margin-top and margin-height values to half the dimensions
of your image.

If you have other content on the page then that content may
over/underlap the image, possibly making it unclickable.
The following markup does not appear to allow for a hyperlink
<style type="text/css">
body
{
background-image:
url('smiley.gif');
background-repeat:
no-repeat;
background-position:
center;
}
</style>

A background-image is decoration. It serves no functional purpose
(though obviously it serves a decorative purpose with all the
implications for user experience that implies). If an image is to be a
link then it has a functional purpose then it must not be a background
image.
(posted also in alt.html.critique)

Please don't multi-post. If you must, cross-post and pick one group
for followups. This response cross-posted and followups set to
alt.html.

Steve
 
A

abby

Steve said:
img.foo {psoition: absolute; top: 50%; left: 50%; margin-top -100px;
margin-left: -100px;}

<a href="bar.html"><ing class="foo" src="foo.gif" alt="Foo Bar"
width="200" height="200"></a>

Change the margin-top and margin-height values to half the dimensions
of your image.

If you have other content on the page then that content may
over/underlap the image, possibly making it unclickable.


A background-image is decoration. It serves no functional purpose
(though obviously it serves a decorative purpose with all the
implications for user experience that implies). If an image is to be a
link then it has a functional purpose then it must not be a background

Please don't multi-post. If you must, cross-post and pick one group
for followups. This response cross-posted and followups set to
alt.html.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <[email protected]> <http://steve.pugh.net/>


Thanks a million Steve
....that worked fine (once I changed spelling for "psoition" and "ing
class" and also added a ":" to "margin-top" :)
I used your markup at http://www.cregg-house.com (yeah, they insisted
on a splash page image)
 
A

abby

Thanks a million Steve
....that worked fine (once I changed spelling for "psoition" and "ing
class" and also added a ":" to "margin-top" :)
I used your markup at http://www.cregg-house.com (yeah, they insisted
on a splash page image)
 

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,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top