473,387 Members | 3,810 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,387 software developers and data experts.

Image replacement for a single letter?

Hello,

I am trying to do a simple (ha ha) bit of image replacement, so that the
'v' in a string of text inside an <h3> is replaced with an image of a
tick that looks like a 'v' to fit with a company logo (imagine
"Ferretweave" with the 'v' replaced by a tick instead of the letter).

I have tried various things, but have not had any success yet, mainly
because all of the IR techniques I have seen seem to depend on the
element that contains the text being a block-level one, which isn't the
case here.

I have HTML like this...

<h3>Welcome to Ferretwea<span>v</span>e</h3>

where I put the 'v' in a <span> in an attempt to apply a background
image to it. I cna apply the image, but not hide the letter. Any ideas?

Haven't got an URL to show as I don't have anything more than this bit
of HTML to show so far ;-(

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 13 '06 #1
15 2721
Alan Silver wrote:

I have HTML like this...
<h3>Welcome to Ferretwea<span>v</span>e</h3>

where I put the 'v' in a <span> in an attempt to apply a background
image to it. I cna apply the image, but not hide the letter. Any ideas?

In the span ruleset make the foreground color the same as the
background. Or change the foreground color to transparent. Or set the
font-size to 0.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jun 13 '06 #2
In article <G_******************************@giganews.com>, Jim Moe
<jm***************@sohnen-moe.com> writes
Alan Silver wrote:

I have HTML like this...
<h3>Welcome to Ferretwea<span>v</span>e</h3>

where I put the 'v' in a <span> in an attempt to apply a background
image to it. I cna apply the image, but not hide the letter. Any ideas?
In the span ruleset make the foreground color the same as the
background.


Then you end up with background-coloured text over the background image.
Or change the foreground color to transparent.
The text was displayed in black (not sure why black) in at least one of
the browsers
Or set the
font-size to 0.


Trouble is that this shrinks the width of the <span> down to zero, and
as it's an inline element, I can't set a width on it, so the image
doesn't appear.

Thanks anyway. Any other ideas?

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 13 '06 #3
To further the education of mankind, Alan Silver <alan-
si****@nospam.thanx.invalid> vouchsafed:
Hello,

I am trying to do a simple (ha ha) bit of image replacement, so that the
'v' in a string of text inside an <h3> is replaced with an image of a
tick that looks like a 'v' to fit with a company logo (imagine
"Ferretweave" with the 'v' replaced by a tick instead of the letter).

I have tried various things, but have not had any success yet, mainly
because all of the IR techniques I have seen seem to depend on the
element that contains the text being a block-level one, which isn't the
case here.

I have HTML like this...

<h3>Welcome to Ferretwea<span>v</span>e</h3>

where I put the 'v' in a <span> in an attempt to apply a background
image to it. I cna apply the image, but not hide the letter. Any ideas?

Haven't got an URL to show as I don't have anything more than this bit
of HTML to show so far ;-(


I ain't tried this but maybe insert another span inside the original span
and style the new span transparent.

--
Neredbojias
Infinity has its limits.
Jun 14 '06 #4
Deciding to do something for the good of humanity, Alan Silver
<al*********@nospam.thanx.invalid> declared in
comp.infosystems.www.authoring.stylesheets:
where I put the 'v' in a <span> in an attempt to apply a background
image to it. I cna apply the image, but not hide the letter. Any ideas?


Interesting question. Neredbojias' suggestion of nested spans seems to
work here - set visibility: hidden; on the inner span, and the
background image on the outer span. Tested in FF1.5, Opera8.5 and IE6.

I can't help thinking you'd be better off using an image for the whole
header though, as the image won't scale with font size so your tick
could look really small (or big) depending on your visitor's preferred
font size.

--
Mark Parnell
My Usenet is improved; yours could be too:
http://blinkynet.net/comp/uip5.html
Jun 14 '06 #5
In article <1e****************@markparnell.com.au>, Mark Parnell
<we*******@clarkecomputers.com.au> writes
Deciding to do something for the good of humanity, Alan Silver
<al*********@nospam.thanx.invalid> declared in
comp.infosystems.www.authoring.stylesheets:
where I put the 'v' in a <span> in an attempt to apply a background
image to it. I cna apply the image, but not hide the letter. Any ideas?
Interesting question. Neredbojias' suggestion of nested spans seems to
work here - set visibility: hidden; on the inner span, and the
background image on the outer span. Tested in FF1.5, Opera8.5 and IE6.


OK, it's an idea. I'll see how it works.
I can't help thinking you'd be better off using an image for the whole
header though, as the image won't scale with font size so your tick
could look really small (or big) depending on your visitor's preferred
font size.


That's not such a problem as the tick looks OK at a reasonably wide
range of font sizes. I kind of assume that anyone using extreme font
sizes is going to see so many pages that are painfully distorted, that a
small issue like the tick being the wrong size is hardly going to be a
problem!!

Having said that, I was coming to the conclusion that replacing the
whole word is probably going to be the safest way to go. Shame, I was
trying to replace as little as possible.

Thanks for the reply.

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 14 '06 #6
On Wed, 14 Jun 2006, Alan Silver wrote:
That's not such a problem as the tick looks OK at a reasonably wide
range of font sizes.
If you make your image with smooth edges (typically in jpeg format)
you can size it in em units so that it scales with the text.

In practice, if you try this, you probably want to make the image
rather larger than "natural size"[1], and scale it down to fit. That
way, the defects of scaling are less evident, over a fair range of
sizes.

Don't try this with hard edges and gifs (or indexed PNG), as the
rescaling will produce horrible "jaggies" in many cases.

None of U+2611, U+2713 or U+2714 are in MS WGL4, so the prospects for
getting them displayed even on properly set-up MesSIEs is not good.

But you could write alt="✓" on your image, for the benefit of
more advanced browsers like Lynx (SCNR).

[1] It's got to be your judgment as to what px size is "natural", I'm
afraid ;-)
I kind of assume that anyone using extreme font sizes is going to
see so many pages that are painfully distorted, that a small issue
like the tick being the wrong size is hardly going to be a problem!!


I wouldn't be quite so pessimistic.

Here's a rough and ready example: I'm sure it could be improved
http://ppewww.ph.gla.ac.uk/~flavell/tests/ferret.html

Try text zoom to see it in action.

cheers
Jun 14 '06 #7
In article <Pi*******************************@ppepc20.ph.gla. ac.uk>,
Alan J. Flavell <fl*****@physics.gla.ac.uk> writes
On Wed, 14 Jun 2006, Alan Silver wrote:
That's not such a problem as the tick looks OK at a reasonably wide
range of font sizes.


If you make your image with smooth edges (typically in jpeg format)
you can size it in em units so that it scales with the text.

<snip>

That's a good idea, thanks.
I kind of assume that anyone using extreme font sizes is going to
see so many pages that are painfully distorted, that a small issue
like the tick being the wrong size is hardly going to be a problem!!


I wouldn't be quite so pessimistic.

Here's a rough and ready example: I'm sure it could be improved
http://ppewww.ph.gla.ac.uk/~flavell/tests/ferret.html

Try text zoom to see it in action.


Looks very good, certainly good enough for my needs.

Now, if you only had a way of doing this in CSS rather than using an
<img> tag I would be even happier ;-)

Thanks for the reply

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 14 '06 #8
In message <Pi*******************************@ppepc20.ph.gla. ac.uk>,
Alan J. Flavell <fl*****@physics.gla.ac.ukwrites
>Here's a rough and ready example: I'm sure it could be improved
http://ppewww.ph.gla.ac.uk/~flavell/tests/ferret.html
[belated response]

Alan, I'm surprised at you!

How will that read in an aural browser? Or be indexed by a search
engine, or found by a page search? Or cut & paste into someone's text
programme? Or look when enlarged greatly?

There are so many reasons why it's not a good idea.
--
Andy Mabbett
Say "NO!" to compulsory ID Cards: <http://www.no2id.net/>

Free Our Data: <http://www.freeourdata.org.uk>
Jul 11 '06 #9
On 2006-07-11, Andy Mabbett wrote:
In message <Pi*******************************@ppepc20.ph.gla. ac.uk>,
Alan J. Flavell <fl*****@physics.gla.ac.ukwrites
>>Here's a rough and ready example: I'm sure it could be improved
http://ppewww.ph.gla.ac.uk/~flavell/tests/ferret.html

[belated response]

Alan, I'm surprised at you!

How will that read in an aural browser?
It sounds all right, but could be improved with a different alt
attribute.
Or be indexed by a search engine, or found by a page search?
Heaven forbid! ;)
Or cut & paste into someone's text programme?
No problem.
Or look when enlarged greatly?
It scales as it should (<img ... height: 1em;).
There are so many reasons why it's not a good idea.
Name one.

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
Jul 11 '06 #10
On Tue, 11 Jul 2006, Andy Mabbett wrote belatedly:
Alan J. Flavell <fl*****@physics.gla.ac.ukwrites
Here's a rough and ready example: I'm sure it could be improved
http://ppewww.ph.gla.ac.uk/~flavell/tests/ferret.html

Alan, I'm surprised at you!
To the best of my recollection, the thread had already discussed
some of the negative implications of this approach...

It's in my /tests/ directory, for the purpose of discussion and
criticism. So go right ahead, feel free.
How will that read in an aural browser?
Badly. It depends what you want to achieve, I guess. I was
illustrating how the visual gag could be made to work in a text
browser.

But I've now added a mark 2 heading with the alt text set to "v".

Either of them, though, will upset speaking browsers - which could, in
theory, be dealt with by aural CSS. In fact, I now know how to do
that for Opera - since the simple way shown in the spec seems to be
failing, I'm using a technique that isn't the simplest, but does seem
to be specification-conforming as well as getting Opera into gear.
I've just modified the test file accordingly, if you want to try it
with Opera voice. WFM, anyway.
Or be indexed by a search engine, or found by a page search?
Indeed; you'd have to sneak a copy of the actual word, without the
graffito, into the page somewhere to get it indexed. Supplying it as
a title attribute is probably not enough to get it into search
engines in general.
Or cut & paste into someone's text programme?
Interesting question. If I try the version where the alt text is "v",
I get:

Opera - Ferretweae
Mozilla - Ferretweave
MesSIE - Ferretweae

So, it seems Mozilla copies the alt text, but the others don't.
Or look when enlarged greatly?
I'm sorry - I was careless with the image, and it shows an unwanted
thin line at the bottom, which gets quite annoying at large sizes.
I think jpegs need to be made at a size which is some multiple of
(is it 8? or 16? px) to avoid this happening.

But, other than that, I viewed the thing at e.g 500% , which is a
massive magnification for text, and it worked fine for me. CSS
support is of course necessary for this to work.
There are so many reasons why it's not a good idea.
Oh, as a casual decoration for a page, provided the various issues
are addressed in their different ways, I think it would be excusable.

In my defence, there are millions of web pages out there which are
*far, far* worse than this little bit of fun, yet their authors are
blissfully unaware of just how bad they are.

But no-one should copy such an example without being aware of the
implications! Does that pacify you a little bit?
Jul 11 '06 #11
In message <Pi*******************************@ppepc87.ph.gla. ac.uk>,
Alan J. Flavell <fl*****@physics.gla.ac.ukwrites
>On Tue, 11 Jul 2006, Andy Mabbett wrote belatedly:
>http://ppewww.ph.gla.ac.uk/~flavell/tests/ferret.html

Alan, I'm surprised at you!

To the best of my recollection, the thread had already discussed
some of the negative implications of this approach...
Not those I mention; or at least not most of them.
>It's in my /tests/ directory, for the purpose of discussion and
criticism. So go right ahead, feel free.
>How will that read in an aural browser?

Badly. It depends what you want to achieve, I guess.
Accessibility.
I was
illustrating how the visual gag could be made to work in a text
browser.

But I've now added a mark 2 heading with the alt text set to "v".
<h1and <h3>, but no <h2!

Still, at least you now have a DOCTYPE declaration...
>Either of them, though, will upset speaking browsers - which could, in
theory, be dealt with by aural CSS. In fact, I now know how to do
that for Opera - since the simple way shown in the spec seems to be
failing, I'm using a technique that isn't the simplest, but does seem
to be specification-conforming as well as getting Opera into gear.
I've just modified the test file accordingly, if you want to try it
with Opera voice. WFM, anyway.
Very clever, but, oddly, it doesn't seem to work if I only select
(sweeping the mouse from right to left) up to the letter "f", or if I
double-click on the word.
>Or be indexed by a search engine, or found by a page search?

Indeed; you'd have to sneak a copy of the actual word, without the
graffito, into the page somewhere to get it indexed. Supplying it as
a title attribute is probably not enough to get it into search
engines in general.
Indeed - and doing so elsewhere on the page may surely result in a lower
ranking than having it in the H1?
>Or cut & paste into someone's text programme?

Interesting question. If I try the version where the alt text is "v",
I get:

Opera - Ferretweae
Mozilla - Ferretweave
MesSIE - Ferretweae

So, it seems Mozilla copies the alt text, but the others don't.
That is interesting.

>There are so many reasons why it's not a good idea.

Oh, as a casual decoration for a page, provided the various issues
are addressed in their different ways, I think it would be excusable.
Perhaps: but an <H3tag (per the OP) is hardly a casual decoration, is
it?
>In my defence, there are millions of web pages out there which are
*far, far* worse than this little bit of fun, yet their authors are
blissfully unaware of just how bad they are.
Which might also be said in justification for not having valid markup,
or good alt attributes, or relying on CSS, or...
>But no-one should copy such an example without being aware of the
implications! Does that pacify you a little bit?
I'm perfectly, er, pacific, just surprised at your apparent abandonment
of your usual purism. You are Alan J. Flavell, and not an impostor,
aren't you? ;-)
--
Andy Mabbett
Say "NO!" to compulsory ID Cards: <http://www.no2id.net/>

Free Our Data: <http://www.freeourdata.org.uk>
Jul 12 '06 #12
On Wed, 12 Jul 2006, Andy Mabbett wrote:
<h1and <h3>, but no <h2!
Would Sir like that with caviar on a gold plate?

It was (originally) only a quick test, thrown together merely to show
what I meant. I left out all the usual furniture.
Still, at least you now have a DOCTYPE declaration...
Only because I decided it was growing out of proportion to its
original aim, and I wanted to be able to validate it.

(I'll give you an <h2up the bracket if you like...)

cheers
Jul 12 '06 #13
Alan J. Flavell wrote:
But no-one should copy such an example without being aware of the
implications! Does that pacify you a little bit?
One of the principles of technical writing:

Given a clear, simple, concise, accurate, unambiguous,
and correct exposition of the correct form or procedure,
accompanied by a sloppy or incorrect example, the majority
will follow the example.

--
Wes Groleau

Truth often suffers more from the heat of its defenders
than from the arguments of its opposers.
-- William Penn
Jul 13 '06 #14
On Thu, 13 Jul 2006, Wes Groleau wrote:
Alan J. Flavell wrote:
But no-one should copy such an example without being aware of the
implications! Does that pacify you a little bit?

One of the principles of technical writing:
Welcome to Usenet!
Given a clear, simple, concise, accurate, unambiguous,
and correct exposition of the correct form or procedure,
And you're sure that all of your own usenet postings are in full
conformance with that principle?
accompanied by a sloppy or incorrect example, the majority
will follow the example.
Usenet was ever a source of potentially misleading clues. Follow the
resulting discussion and peer-review, and you may learn something.
Take a single specimen out of context, and you may ultimately regret
it. I think that's a fair assessment.

Mind you, considering the average quality of usenet postings, I guess
I should take it as a compliment that you were prepared to take mine
seriously :-}

a.t.b
Jul 13 '06 #15


Alan J. Flavell wrote:
And you're sure that all of your own usenet postings are in full
conformance with that principle?
Of course not! When in Rome ....

:-)

--
Wes Groleau
-----------
Curmudgeon's Complaints on Courtesy:
http://www.onlinenetiquette.com/courtesy1.html
(Not necessarily my opinion, but worth reading)
Jul 13 '06 #16

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

Similar topics

5
by: siliconmike | last post by:
On many websites they have a blurred image with a code which you're supposed to reenter in a text box to validate your form submission. How do I implement such a thing using php? Apart from...
53
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore...
7
by: xiibweb | last post by:
Hi I am struggling to find a code meeting my requirements... I want to display 4 thumbnails of photos in a row (table 1X4). When any thumb is clicked the large image size shud appear just below...
0
by: Anonieko Ramos | last post by:
> I have a graphics images that I want to convert to > ASCII art. How do I do it? > Code: - Default.aspx.cs
4
by: Sjaakie | last post by:
I need to replace parts of a string, in a collection deserialized from an XML file, with values from another collection. Is there another, more clever/faster/better, method than the loops below? ...
4
by: Deere | last post by:
When I try to take a database field and change it with a function and return it...it will not display the image. The "Imageurl" does not convert to "src=" but stays as ImageUrl. id=Image2 will...
6
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to...
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.