In my first version of this question, I did not offer enough information, sorry. Here is a clearer version of what help I need. Many of your answers are already close, this will help:
A much more specific version of this question:
I decided to use php with css so that my pages work more efficiently than if I could achieve the same result using javascript. It does not matter. The important thing is that the two methods that I tried to do this (as shown in the tutorial):
adding
AddType application/x-httpd-php .css
in my .htaccess
Then, when the stylesheet appeared in the sources of the page, but did not affect the page I tried to use
<link rel="stylesheet" href="style.php" media="screen">
to link my stylesheet as a php file, as suggested in this tutorial. http://www.phpro.org/articles/Embedding-PHP-In-CSS.html
Here was the css that I tested with php variables:
<?php header("Content-type: text/css"); $para_color = '#0000ff'; $heading_size = '2em'; $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 result: css, displayed exactly as it should, as the source of the stylesheet, but not displayed on the UNLESS page, I made changes to the style in dev dev tools, after which the page will be just fine .
Question: Why is this happening, and how to fix it?
Old version:
The question here is simple:
How can I use PHP in CSS?
I am creating a website where it will be much more effective both in time and in processing speed for me to use php in CSS to achieve various desired results, instead of using javascript.
I am told that this can be done. How?