Title: url function for css
Last modified: August 22, 2016

---

# url function for css

 *  Resolved [michaelpon12](https://wordpress.org/support/users/michaelpon12/)
 * (@michaelpon12)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/url-function-for-css/)
 * I have a css for my site
 *     ```
       background: #e5ddc8 url(http://fabioide.com/frederiksminde/wp-content/uploads/2014/10/fredshotel-headbgg.png) top left repeat-x;
       }
       ```
   
 * I want to change the url to a more consistent code by using funtion because if
   ever I change my site location it will not detect the url since i change the 
   url. what is the right url to get the wordpress link of the site to access the
   wp-content.
 *     ```
       background: #e5ddc8 url(/wp-content/uploads/2014/10/fredshotel-headbgg.png) top left repeat-x;
       }
       ```
   
 * I try to use this code but nothing happens the image doesn’t load.

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

 *  [Aaron Hockley](https://wordpress.org/support/users/ahockley/)
 * (@ahockley)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/url-function-for-css/#post-5451452)
 * To use a relative URL, I believe it needs to be relative to the directory where
   the theme’s style.css is loaded. If you’re trying to get it to link to the file
   in your example above, note that your style.css is probably located at:
 * `wp-content/themes/themename/style.css`
 * So the path is going to be:
 *     ```
       background: #e5ddc8 url("../../uploads/2014/10/fredshotel-headbgg.png") top left repeat-x;
       }
       ```
   
 *  [jr361202](https://wordpress.org/support/users/jr361202/)
 * (@jr361202)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/url-function-for-css/#post-5451454)
 * use:
 * background: #e5ddc8 url(“/frederiksminde/wp-content/uploads/2014/10/fredshotel-
   headbgg.png”) top left repeat-x;
 * There should be quotes (double or single, doesn’t matter) around the url as in
   my example.
 *  Thread Starter [michaelpon12](https://wordpress.org/support/users/michaelpon12/)
 * (@michaelpon12)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/url-function-for-css/#post-5451461)
 * Placed the image on my themes folder under images using the FTP
 * then change my css to this
 *     ```
       body
       {
           background: #e5ddc8 url(images/fredshotel-headbgg.png) top left repeat-x;
       }
       ```
   
 *  [jr361202](https://wordpress.org/support/users/jr361202/)
 * (@jr361202)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/url-function-for-css/#post-5451462)
 * Well if that worked for you then it worked, looks like you didn’t need our advice.
   You should still have quotes around the url though.

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

The topic ‘url function for css’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [jr361202](https://wordpress.org/support/users/jr361202/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/url-function-for-css/#post-5451462)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
