Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 09:28 PM
Tristan Miller
Guest
 
Posts: n/a
Default CSS, images, and invisible <span> text

Greetings.

Occasionally I come across sites that use something like the following
combination of CSS and HTML:

h1 {
height:100px;
width: 500px;
background:url(welcome.gif) no-repeat;
}

h1 span {display:none;}

<h1><span>Welcome to my home page!</span></h1>

I'm a bit confused by this usage. What is the reason for doing it this way
rather than doing everything in HTML, as follows?

<h1><img src="welcome.gif" width="500" height="100" alt="Welcome to my home
page!" /></h1>

Is it because <img> is not allowed in headers? Regardless, where in the
(X)HTML specifications is it explained which tags are allowed to occur
within which other tags?

Regards,
Tristan

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
  #2  
Old July 20th, 2005, 09:28 PM
David Dorward
Guest
 
Posts: n/a
Default Re: CSS, images, and invisible <span> text

Tristan Miller wrote:
[color=blue]
> Greetings.
>
> Occasionally I come across sites that use something like the following
> combination of CSS and HTML:[/color]

<snip> Image Replacement Code </snip>
[color=blue]
> I'm a bit confused by this usage. What is the reason for doing it this
> way rather than <snip>[/color]

.... using alt.

Some people believe that search engines give lower weight to alt text then
real text and are happy to make their sites less accessible to people who
browse with CSS enabled and images disabled.


--
David Dorward http://dorward.me.uk/
  #3  
Old July 20th, 2005, 09:28 PM
Alan J. Flavell
Guest
 
Posts: n/a
Default Re: CSS, images, and invisible <span> text

On Fri, 3 Oct 2003, Tristan Miller wrote:

[snip question already answered by David Dorward]

[f'ups narrowed as this part is specific to HTML]
[color=blue]
> Is it because <img> is not allowed in headers?[/color]

By no means: <img> most certainly _is_ legal in <h*> heading markups,
and if the image forms part of a heading certainly _should_ be put
there, for logical structure (even if many browsers will not care one
way or the other).
[color=blue]
> Regardless, where in the (X)HTML specifications is it explained
> which tags are allowed to occur within which other tags?[/color]

Technically, that is determined by the DTD. If you don't feel up to
tackling that yet, then you'll find a useful reference format derived
from it (at least for HTML4), along with other useful matter at the
WDG, see e.g

E.g for your present question, start at
http://www.htmlhelp.com/reference/html40/
Go to http://www.htmlhelp.com/reference/html40/alist.html

From there choose e.g H1, you'll find it can contain "inline
elements". Click on the link to find what those are.

Conversely, choose IMG, and find what it may be contained in.

good luck

  #4  
Old July 20th, 2005, 09:28 PM
jake
Guest
 
Posts: n/a
Default Re: CSS, images, and invisible <span> text

In message <13834965.47JySNq8FG@ID-187157.news.dfncis.de>, Tristan
Miller <psychonaut@nothingisreal.com> writes[color=blue]
>Greetings.
>
>Occasionally I come across sites that use something like the following
>combination of CSS and HTML:
>
>h1 {
> height:100px;
> width: 500px;
> background:url(welcome.gif) no-repeat;
> }
>
>h1 span {display:none;}
>
><h1><span>Welcome to my home page!</span></h1>
>
>I'm a bit confused by this usage. What is the reason for doing it this way
>rather than doing everything in HTML, as follows?
>
><h1><img src="welcome.gif" width="500" height="100" alt="Welcome to my home
>page!" /></h1>
>
>Is it because <img> is not allowed in headers? Regardless, where in the
>(X)HTML specifications is it explained which tags are allowed to occur
>within which other tags?
>
>Regards,
>Tristan
>[/color]
Read this:

http://www.stopdesign.com/also/articles/replace_text/

........... but be sure to read the last paragraph.

regards.


--
Jake
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles