Title: CSS Help
Last modified: August 19, 2016

---

# CSS Help

 *  Resolved [avecchioni](https://wordpress.org/support/users/avecchioni/)
 * (@avecchioni)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/css-help-9/)
 * wp 2.84/ theme: sliding doors
 * I’m having trouble using php in a css (image menu) file. I’d like to change this:
 *     ```
       #imageMenu ul li.bk1 a {
       	background: url(images/A_1.jpg) repeat scroll 0%;
       }
       ```
   
 * to this:
 *     ```
       #imageMenu ul li.bk1 a {
       	background: url(images/A_<?php echo(rand(1,7)); ?>.jpg) repeat scroll 0%;
       }
       ```
   
 * The images A_1 thru A_7 have been uploaded via ftp to the appropriate folder,
   but the code produces white space where the random photo should appear. I’ve 
   used the echo code in ordinary theme files previously, but don’t know how to 
   employ it in a css file. Can someone point me in the right direction? Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [jon](https://wordpress.org/support/users/adiant/)
 * (@adiant)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/css-help-9/#post-1224132)
 * php does not get executed in linked external stylesheets.
 * I’ve never tried it, but the following should work:
 * (1) remove from CSS
    (2) add the following to header.php after the link to CSS(
   assuming that you are using header.php):
 *     ```
       <style>
       <!--
       #imageMenu ul li.bk1 a {
       	background: url(images/A_<?php echo(rand(1,7)); ?>.jpg) repeat scroll 0%;
       }
       -->
       </style>
       ```
   
 *  Thread Starter [avecchioni](https://wordpress.org/support/users/avecchioni/)
 * (@avecchioni)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/css-help-9/#post-1224205)
 * Thanks for the reply. Doesn’t seem to be working. I removed from css (image menu)
   file and inserted into header.php. I even took out the php echo portion of the
   image url to simplify. The code is now:
 *     ```
       <style>
       <!--
       #imageMenu ul li.bk1 a {
       	background: url(images/A_1.jpg) repeat scroll 0%;
       }
       -->
       </style>
       ```
   
 * I tried to insert this (after link to css) in the following locations: Within
   head tag /After head tag before body tag/ Within body tag/ Within body tag also
   within div id=”imageMenu”/ And various other places. Any idea what I’m doing 
   wrong? Here’s url: [http://mrsvecchionisartroom.com/blog/](http://mrsvecchionisartroom.com/blog/)
 *  Thread Starter [avecchioni](https://wordpress.org/support/users/avecchioni/)
 * (@avecchioni)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/css-help-9/#post-1224216)
 * If this helps– I also uncommented the code to no avail.
 *  Thread Starter [avecchioni](https://wordpress.org/support/users/avecchioni/)
 * (@avecchioni)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/css-help-9/#post-1224225)
 * Got it. Per this post: [http://www.barelyfitz.com/projects/csscolor/](http://www.barelyfitz.com/projects/csscolor/)
   I made following changes:
 * **–**changed name of imageMenu.css to imageMenu.php
    **–**added this to top of
   imageMenu.php: <?php header(“Content-type: text/css”); ?> **–**in header.php,
   changed the stylesheet references from style.css to style.php **–**reinserted
   php echo code (for rotating images) into imageMenu.php
 * Tested in firefox and ie, works fine. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘CSS Help’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [avecchioni](https://wordpress.org/support/users/avecchioni/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/css-help-9/#post-1224225)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
