Jump to content

Recommended Posts

Just a simple question I've tested this in a browser and it works.

 

I know you can set the content-type using the header funtion for example

 

header("Content-Type: text/css");

 

Does this mean that you can use php to generate a css stylesheet for example

 

instead of having a file names style.css you have it named styles.php that contains

 

<?php
header("Content-Type: text/css");
?>

 

at the top of the file

 

for example here is the start if a test file I have created

 

<?php
header("Content-Type: text/css");
?>
body {

   height: 100%;
   color: black;

}

div#topmenu
{
	background: #000066;
	position: absolute;
	position: fixed;
	top: 0px;
	left: 13%;
	width: 87%;
	height: 13%;
	text-align: center;
	z-index: 3;
}

/*styles continue but not needed for this example */

 

If this is valid, This means you can dynamicaly generate css content, am I right in thinking this. Or is there a problem I'm not realising.

 

If I'm right this could solve a lot of probems I've been having.

 

Is this valid? would it work across all browsers?

Link to comment
https://forums.phpfreaks.com/topic/73582-solved-dynamic-stylesheets/
Share on other sites

If this is valid it would allow the power of php to be applied to stylesheets.

 

I'm just asking if it's valid before I go changing everything ove ron my sites, as this would allow a lot of flexibility being able to do variables and if's in styesheets.

 

but I'm hoping for an answer from someone more experienced first if this is valid

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.