Posted: 14.01.2006 13:34 Post subject: "No More CSS Hacks" for the non-programmer
Quote sa stylegala foruma
Quote:
Intro
Today I read David Hellsing's "No More CSS Hacks" which (if you haven't read it) explains and gives examples to for how to go about serving up browser specific css using php... essentially replacing css hacks. It's a great article and very informative. However, it's my opinion that the sight of all that php code can scare away the non-programmers among us.
I've been using server-side css "hacks" for the half-year or so. At some point (I guess about four months ago) I got sick of writing repetitive php if statements in my css. It took to long, and it made it harder to read. So I wrote a simple markup and parser to save myself time.
Browsers are labeled with lower case letters (examples: internet explorer, netscape, firefox, opera).
Don't try to user "greater than" or "less than" in conjunction with "not"... that's just asking for trouble.
I'm sure that that code isn't perfect. I haven't uber-extensively tested it. If you spot any errors, please let me know.
By rearranging the order of browser detection (adding opera before msie) you should be able to sniff out opera even when it pretends to be internet explorer.
I've added a few simple regular expressions at the end to make the output neat and tidy in terms of line-spacing.
Nisam probao još, ali čini mi se jako dobro i jednostavno za koristit. Mišljenja?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum