favicon & css

P

Paul Goodwin

I have a client who wishes one of these 'favicons' on every page of a fairly
large site, what I'm wondering, in order to save time, is if it's possible
to add the icon via the external stylesheet, instead of laboriously adding
it to each page.

Thank you :)

Paul
 
B

Beauregard T. Shagnasty

Paul said:
I have a client who wishes one of these 'favicons' on every page of
a fairly large site, what I'm wondering, in order to save time, is
if it's possible to add the icon via the external stylesheet,
instead of laboriously adding it to each page.

No way that I know of to use CSS for a favicon. You would have to add
the following in the <head> section of the pages. Use correct path, of
course:

<link rel="shortcut icon" href="path/favicon.ico" type="image/x-icon">
<link rel="icon" href="path/favicon.ico" type="image/x-icon">

It must also be a 16x16 true icon file.

This would be easy if the stuff in the <head> were added to each page
by a script, as I do; one file for the whole site.

Internet Explorer users will not see it unless they bookmark the site,
and then only until the cache is cleared.
 
T

Tina - AxisHOST, Inc.

Beauregard T. Shagnasty said:
No way that I know of to use CSS for a favicon. You would have to add the
following in the <head> section of the pages. Use correct path, of course:

<link rel="shortcut icon" href="path/favicon.ico" type="image/x-icon">
<link rel="icon" href="path/favicon.ico" type="image/x-icon">

It must also be a 16x16 true icon file.

This would be easy if the stuff in the <head> were added to each page by a
script, as I do; one file for the whole site.

Internet Explorer users will not see it unless they bookmark the site, and
then only until the cache is cleared.

Yes. I was going to suggest putting the whole top area of the page
(generally meta, logo headers, menu) in an include - either ssi or php. You
could include the favicon bit in that.

--Tina
 
B

Benjamin Niemann

Paul said:
I have a client who wishes one of these 'favicons' on every page of a
fairly large site, what I'm wondering, in order to save time, is if it's
possible to add the icon via the external stylesheet, instead of
laboriously adding it to each page.

It's sufficient to place the icon as 'favicon.ico' in the root folder of the
site. That's the location a browser will look for (*), when it tries to
load the favicon (look at your server logs and you'll see a lot of 404
error for '/favicon.ico', because it is not present yet).

(*) unless a different location is specified using <link rel="shortcut
icon" ...>, but that you require a change of every page - something you
don't want to do.
 
P

Paul Goodwin

Tina - AxisHOST said:
Yes. I was going to suggest putting the whole top area of the page
(generally meta, logo headers, menu) in an include - either ssi or php. You
could include the favicon bit in that.

That might be what I'm looking for, thanks for all the replies :)
 
E

Edwin van der Vaart

Benjamin said:
It's sufficient to place the icon as 'favicon.ico' in the root folder of the
site. That's the location a browser will look for (*), when it tries to
load the favicon (look at your server logs and you'll see a lot of 404
error for '/favicon.ico', because it is not present yet).

(*) unless a different location is specified using <link rel="shortcut
icon" ...>, but that you require a change of every page - something you
don't want to do.
Can this also be done with .htaccess?
 
B

Benjamin Niemann

Edwin said:
Can this also be done with .htaccess?

Not directly. You may use mod_rewrite to serve a different file for requests
to '/favicon.ico'. But this .htaccess file must be placed in the root
folder in order to be effective - so there's nothing gained.
 
E

Edwin van der Vaart

Benjamin said:
Not directly. You may use mod_rewrite to serve a different file for requests
to '/favicon.ico'. But this .htaccess file must be placed in the root
folder in order to be effective - so there's nothing gained.
Thanx for the information.
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top