In my first version of this question, I did not offer enough information, I am sorry. Here is a clearer version of what help I need. Many of your answers are close already, this will help:
Much More Specific Version of This Question:
I've decided to use php with css to make my pages work more efficiently than they would if I were to achieve the same outcome with javascript. This is not important. What's important is that the two methods that I have tried to do this (as shown in a tutorial) are:
adding
AddType application/x-httpd-php .css
to my .htaccess
Then, when the style sheet showed up in the page's sources but did not have an affect on the page I tried using
<link rel="stylesheet" href="style.php" media="screen">
to link my stylesheet as a php file, as suggested by this tutorial. http://www.phpro.org/articles/Embedding-PHP-In-CSS.html
Here was the css that I was testing with the php variables:
<?php
/*** set the content type header ***/
header("Content-type: text/css");
/** set the paragraph color ***/
$para_color = '#0000ff';
/*** set the heading size ***/
$heading_size = '2em';
/*** set the heading color ***/
$heading_color = '#c0c0c0';
?>
p{
color: <?php echo $para_color; ?>;
font-weight: bold;
font-size: 1.2em;
text-align: left;
}
h1{
color: <?php echo $heading_color; ?>;
font-size = <?php echo $heading_size; ?>;
text-align: centre;
}
Both methods gave me the same outcome, with the css showing up exactly as is should as a stylesheet source, but not showing up on the page UNLESS I made a change to the style in the page's dev tools, after which the page would style just fine.
Question: Why is this happening, and how do I fix it?
Old Version:
The question here is a simple one:
How can I use PHP in CSS?
I am creating a website where it will be much more efficient both in time and in processing speed for me to use php within CSS to achieve various desired results, rather than using javascript.
I'm told that this can be done. How?