Re: CSS / PHP / Javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You can use a browser sniffer, where they've done all the work for you, and then link in the appropriate stylesheet using document.write(). I don't have personal experience with the IE conditionals, but I would be concerned that they'd get you into a bit of a box when it comes to recognizing other browsers.

See:  http://www.webreference.com/tools/browser/javascript.html

Jochem Maas wrote:
hmmm, this reply turned into something that resembles a rant about halfway thru...
still ... maybe it's helpful in some way.

Ed Lazor wrote:
I'm reading a book on CSS and how you can define different style sheets
for different visitors.  I'm wondering how you guys do it.  The book
recommends using Javascript functions for identifying the user's browser
and matching them with the corresponding style sheets.  Anyone using PHP
for this instead - specifically with defining style sheets for different
target browsers and platforms?

having to define CSS files for particular browsers and/or platforms is indicative
of the crap we have to deal with - in theory you should NOT be targeting browser/platform
specificallt AT ALL. you should be writing stylesheets for different types
of user-agents (as defined by the W3C media types) - but who is really doing that.

I recommend trying to build your sites using CSS that all browsers understand
- i.e. avoid software/platform/version specific hacks whenever possible - when you
have to add such a hack try to use a technique that you can unobtrusively incorporate
into an existing CSS file.

the man named tantek has lots of techniques you can abuses ;-) :

	e.g. http://tantek.com/CSS/Examples/midpass.html

also consider that maybe you shouldn't try and tackle every visual discrepency
between 2 different browsers/platforms! - you may have clients who bully you
into 'fixing' layout in WeirdBrowser1.4 for instance - you need to develop a
means to explain the problem to clients in such a way that they understand that
not everything is under your control, and that they can't make you endlessly
chase moving targets (i.e. make the client understand that web != print).

if a client is willing to pay for every mindnumbing hour spent fixing arcane
browser specific display 'bugs' then everything is okay - but don't get stuck
working for weeks for no pay because some marketing manager has 'decided' he/she
knows better what a website is and to what extent you must comply to his implicit
wishes [i.e. you can break every 'rule' of website building and ignore/rape any/every
relevant specification/standard so long as everything ispixel perfect in every browser according
to the original mockup supplied by a graphic designer who can't even grasp the concept
of screen resolution (I know plenty of print-based designers that fall into this category)]

-Ed

--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux