# Dynamic CSS with PHP

**URL:** <https://forum.kirupa.com/t/dynamic-css-with-php/117246>\
**Category:** Uncategorized\
**Created:** [July 26, 2004, 5:22am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246 "2004-07-26T05:22:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 5:22am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/1 "2004-07-26T05:22:18Z")

</div>

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 😛

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:

[http://nokrev.com/archive/Dynamic\_CSS\_with\_PHP/](http://nokrev.com/archive/Dynamic_CSS_with_PHP/)

oh and thanks for that dude that reminded me to use get \_browser 😛

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 6:28am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/2 "2004-07-26T06:28:28Z")

</div>

anybody got a review, or anybody like it?

---

<div class="post-metadata">

**Author:** ![RabBell](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rabbell/32/340_2.png) [@RabBell](https://forum.kirupa.com/u/RabBell)\
**Post date:** [July 26, 2004, 7:45am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/3 "2004-07-26T07:45:01Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 1:49pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/4 "2004-07-26T13:49:39Z")

</div>

[http://bombingpixels.com/php/client.php](http://bombingpixels.com/php/client.php)

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

---

<div class="post-metadata">

**Author:** ![nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@nobody](https://forum.kirupa.com/u/nobody)\
**Post date:** [July 26, 2004, 4:22pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/5 "2004-07-26T16:22:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 4:26pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/6 "2004-07-26T16:26:48Z")

</div>

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 😛

---

<div class="post-metadata">

**Author:** ![nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@nobody](https://forum.kirupa.com/u/nobody)\
**Post date:** [July 26, 2004, 4:28pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/7 "2004-07-26T16:28:30Z")

</div>

But would this work for external stylesheets?

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 4:31pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/8 "2004-07-26T16:31:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahmed](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@ahmed](https://forum.kirupa.com/u/ahmed)\
**Post date:** [July 26, 2004, 4:35pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/9 "2004-07-26T16:35:52Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 4:36pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/10 "2004-07-26T16:36:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahmed](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@ahmed](https://forum.kirupa.com/u/ahmed)\
**Post date:** [July 26, 2004, 4:39pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/11 "2004-07-26T16:39:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 4:40pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/12 "2004-07-26T16:40:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahmed](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@ahmed](https://forum.kirupa.com/u/ahmed)\
**Post date:** [July 26, 2004, 4:41pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/13 "2004-07-26T16:41:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 26, 2004, 4:41pm UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/14 "2004-07-26T16:41:55Z")

</div>

and this certainly floats my boat 🙂

---

<div class="post-metadata">

**Author:** ![nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@nobody](https://forum.kirupa.com/u/nobody)\
**Post date:** [July 27, 2004, 12:05am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/15 "2004-07-27T00:05:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 27, 2004, 12:08am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/16 "2004-07-27T00:08:26Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@nobody](https://forum.kirupa.com/u/nobody)\
**Post date:** [July 27, 2004, 12:35am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/17 "2004-07-27T00:35:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 27, 2004, 12:36am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/18 "2004-07-27T00:36:32Z")

</div>

yep, and it does 🙂

---

<div class="post-metadata">

**Author:** ![bodyvisual](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bodyvisual/32/564_2.png) [@bodyvisual](https://forum.kirupa.com/u/bodyvisual)\
**Post date:** [July 27, 2004, 12:40am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/19 "2004-07-27T00:40:45Z")

</div>

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

btw, it looks pretty solid!

:p:

---

<div class="post-metadata">

**Author:** ![Unit](https://avatars.discourse-cdn.com/v4/letter/u/cc9497/32.png) [@Unit](https://forum.kirupa.com/u/Unit)\
**Post date:** [July 27, 2004, 11:47am UTC](https://forum.kirupa.com/t/dynamic-css-with-php/117246/20 "2004-07-27T11:47:26Z")

</div>

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.

[Next page](https://forum.kirupa.com/t/dynamic-css-with-php/117246.md?page=2)
