using favicon with css

PA. picture PA. · Dec 31, 2011 · Viewed 139.3k times · Source

I want to set the favicon for a fairly large number of pages. But, instead of using the HTML <head> tag <link rel="shortcut icon" href="favicon.ico">, I'd like to set it in the CSS file. I have limited access to some of the html files, and limited control to their life cycle.

Answer

Oded picture Oded · Dec 31, 2011

You can't set a favicon from CSS - if you want to do this explicitly you have to do it in the markup as you described.

Most browsers will, however, look for a favicon.ico file on the root of the web site - so if you access http://example.com most browsers will look for http://example.com/favicon.ico automatically.