473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using images for links

Hi.

I'm trying to create a stylesheet for a page that shows images instead of
text links. I tried to apply the FIR method but apparently that only works
for block-level elements.

Used HTML:

<a href="link.html"><div class="image"><span>text</span></div></a>

Used CSS:

..image {
width: 48px;
height: 48px;
background-image: url(48x48.png);
display: inline;
}

..image span {
display: none;
}

The text in the span element is not shown but neither is the background
image. In addition to that the width and height properties seem to be
ignored.

I also tried moving the css properties into the a element, using span
instead of div, using the id attribute but none of that works the way I
would expect it to.

Am I missing something fundamental here? (Accessibility is not an issue here
as the page will be centered around images so blind people simply do not
belong to the target group. :)
Thanks for help,
David
Nov 5 '05 #1
5 1774
David Roden <dr****@gmail.com> wrote:
I'm trying to create a stylesheet for a page that shows images instead of
text links. I tried to apply the FIR method
For some bizarre reason some people have come to believe that image
replacement techniques are a normal way to code images. It is not, there
are only a few instances where there is an arguable benefit to using IR,
and the drawbacks are nasty enough to avoid using IR techniques in all
but a very few instances.
<a href="link.html"><div class="image"><span>text</span></div></a>


<a href="link.html"><img src="..." width="..." height="..."
alt="text"></a>

--
Spartanicus
Nov 5 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Spartanicus wrote:
<a href="link.html"><img src="..." width="..." height="..."
alt="text"></a>


Oops, I forgot to mention that I want the links to be themeable by a
stylesheet. Of course I know of the IMG tag and how to use it as a link but
that is not the way I want it... though that's what I'd have to revert to
if all IR techniques only work with block-level elements.
Thanks for help,
David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDbKL6sh8Hgp5TwkMRAjB1AJ92uCD2nDeZgchonyYTJY ZlfCTFowCgqYgE
5qza0dhRWxLoqpb5zIpVaCw=
=vQiM
-----END PGP SIGNATURE-----
Nov 5 '05 #3
David Roden wrote:

I'm trying to create a stylesheet for a page that shows images instead of
text links. I tried to apply the FIR method but apparently that only works
for block-level elements.
FIR = Finite Impulse Response?
<a href="link.html"><div class="image"><span>text</span></div></a>
.image {
width: 48px; height: 48px;
background-image: url(48x48.png);
display: inline;
}

Inline objects "shrink to fit" whatever they contain. Inline, as such,
has no height, width or background properties. When you disappear the
text, you disappear the link.
What's wrong with styling <img>?

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Nov 5 '05 #4
On Sat, 05 Nov 2005 11:07:23 -0700, Jim Moe
<jm***************@sohnen-moe.com> wrote:
David Roden wrote:

I'm trying to create a stylesheet for a page that shows images instead of
text links. I tried to apply the FIR method but apparently that only works
for block-level elements.

FIR = Finite Impulse Response?


Fahrner Image Replacement.

As Spartanicus said, perhaps occasionally useful but you should use
ordinary foreground images with ALT text unless you have a clear reason
not to. And (important) text within images is a bad idea anyway.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Nov 6 '05 #5
try this style

a {display: block}

if you want all links to be block level, or this

a.block {display: block}

if you want only those with class block to behave like this

--
Martin Eyles
ma**********@NOSPAM.bytronic.com

"David Roden" <dr****@gmail.com> wrote in message
news:dk*************@news.t-online.com...
Hi.

I'm trying to create a stylesheet for a page that shows images instead of
text links. I tried to apply the FIR method but apparently that only works
for block-level elements.

Used HTML:

<a href="link.html"><div class="image"><span>text</span></div></a>

Used CSS:

.image {
width: 48px;
height: 48px;
background-image: url(48x48.png);
display: inline;
}

.image span {
display: none;
}

The text in the span element is not shown but neither is the background
image. In addition to that the width and height properties seem to be
ignored.

I also tried moving the css properties into the a element, using span
instead of div, using the id attribute but none of that works the way I
would expect it to.

Am I missing something fundamental here? (Accessibility is not an issue here as the page will be centered around images so blind people simply do not
belong to the target group. :)
Thanks for help,
David

Nov 9 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: lawrence | last post by:
In my style sheet I've set the links like this: a:link{ text-decoration:none; } I did that for the pseudo classes and I also did that for the image tag. Yet there are still link lines...
2
by: Matt | last post by:
I posted a question before regarding the offset positions when I used CSS. Some people suggested I should use percentage instead of pixels? I tried many different ways, but the position still...
4
by: Applebrown | last post by:
Greetings, I'm attempting to make a simple horizontal navbar with three image links, and with those images replaced on hover and active... and I'm not sure of the proper CSS to do this, though...
3
by: MediaDesign | last post by:
so there's the problem: my text links have background images and when I put links around images on my page, they too get the background image treatment which I do not...I have tried several...
1
by: unotin | last post by:
I have an application in ASP that exports to Word using the Response.ContentType method. The application references another ASP page through the img tag that uses a Response.BinaryWrite (of an...
9
by: philipl | last post by:
hi, Does anyone have any sample code for this?? I can't find anything relvant at all. Please share out some code if you have any. thx
2
by: mikeoley | last post by:
Ok I have a Javascript slideshow working. Every image is linked to a another page in the site. Problem is...The link wont refresh to the next link once the second images rollovers in the slideshow....
7
by: ohaya | last post by:
Hi, We want to include some SSI in our ASP pages, but where the SSI is located on a different server, and so we need to be able to access the SSI using a full URL, as opposed to a local file...
0
by: zeckdude | last post by:
Hi, I am having some issues with my site. I have a main Nav with four links that load in 4 different sections. You can see the page I am working on here:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.