Dynamic CSS with PHP

sorry to put this in random, but because it’s not a question, figured it might fit here kinda, and that’d get me an excuse to get tons more hits :stuck_out_tongue:

anyways, I just finished a post to my blog about dynamic css with php, removing the need for hacks!

I just wanted to see what you guys thought:


oh and thanks for that dude that reminded me to use get _browser :stuck_out_tongue:

anybody got a review, or anybody like it?

looks good, though I think I’d have to see it in action first because (and I’m not sure why) I’m a little skeptical about it.

might be fun though :slight_smile:


try that in firefox and ie, then view the css page

It’s a good idea, but I don’t see it as being all that useful. Instead of grueling over one stylesheet to get it to look right, you get to make a ton of stylesheets that will have to look all identical with different code. The idea sort of defeats itself.
It’s nice to see people trying new things though, it’s a cool idea. Maybe I’m just old fashioned, I’m sure a lot of people will like this work around.

you don’t have to completely redo each stylesheet, only when there is a bug in the browser and you’d have to use a hack anyways. Notice it’s only one line that’s different for firefox? That’s because the rest of the stylesheet is going to be the same for the browsers, until we will need to use a hack for something like the box model, and then we can simply set the width explicitly for ie 5 and reset the width for all other browsers :stuck_out_tongue:

But would this work for external stylesheets?

of course, view the third comment and look at my example

Yeah, I agree with 38’s comment. I would much rather write a proper single stylesheet that functions the same on all browsers than have php snippits in my css. Worst case I would use the _<property> trick for IE :slight_smile:

I disagree because then you still have to find hacks for tons of different hacks and imo takes much longer… but I guess everybody likes finding hacks but me or something

lol, not bragging or anything, but I managed to create multiple fairly complex tableless layouts that work across multiple browsers the same yet without using any hacks… It’s all about the DOCTYPE!

Good job still… lol

;P, but imo, I’m gonna use my way of course… :stuck_out_tongue: :slight_smile: it’s easier for me at least

haha yup! Whatever floats your boat… or something like that

and this certainly floats my boat :slight_smile:

Yeah along the lines of what ahmped was saying I just don’t see how it’s easier to write more than one stylesheet instead of like one line of extra code to work around various browsers. To each his own though.

;P, I don’t often find one line hacks…

oh well… I will be the one never using hacks again :stuck_out_tongue:

Haha, as long as it works for you then that’s all that matters.

yep, and it does :slight_smile:

what? ahmed said 38. 28 said ahmped. eh?

btw, it looks pretty solid!


This certainly floats my boat (or div… haha…)

I’ve tried this before with big layouts, and the file can easily exceed 20kb, which is pretty huge for css. I also used $_GET instead, which meant that linking it would be a tangle of ='s and &'s.