Title: Trouble adding background image
Last modified: August 19, 2016

---

# Trouble adding background image

 *  Resolved [pullman](https://wordpress.org/support/users/pullman/)
 * (@pullman)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/)
 * Hi everybody
 * I am having trouble adding a background image to my contact page:
 * [http://philipus.com/contact](http://philipus.com/contact)
 * I want it behind the contact form. I’ve tried adding the background image property
   to the “container-inner”, which would cover exactly the area I want covered.
 * But the problem is that the image then appears on the front page, which has a
   gallery (the image will be behind the gallery but 10px or so of the background
   image will be visible below the gallery).
 * How can I get the background image only to appear on the Contact page?
 * Thanks a million
    /p

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367224)
 * more information please
 *  Thread Starter [pullman](https://wordpress.org/support/users/pullman/)
 * (@pullman)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367228)
 * Thanks for quick reply – and apologies, I accidentally pressed “post” before 
   i was done.
 * My second question is how I make the contact form – which is a cForm – transparent(
   except the text fields).
 * Thanks again
    /p
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367237)
 * insert this condition just before the `</head>` tag in header.php:
 *     ```
       <?php
       if(is(page('contact')) :
       echo '<style type="text/css" media="screen">
       .container-inner {
       background:#FFF url('.get_bloginfo('template_url').'/images/contact_bg.jpg) left top no-repeat; }
       </style>';
       endif;
       ?>
       ```
   
 * you can fine tune the background position by using positive or negative px values
   instead of ‘left’ and ‘top’.
 * to get the backgrounds in the form transparent:
    [http://philipus.com/wp-content/plugins/cforms/styling/wide_form.css](http://philipus.com/wp-content/plugins/cforms/styling/wide_form.css)
 *     ```
       .cform fieldset	{
       	margin-top:10px;
       	padding:10px 0 10px 0;
       	border:1px solid #9d9d9d9;
       	border-left-color:#9d9d9d;
       	border-top-color:#9d9d9d;
       	background:transparent;
       }
       ```
   
 *     ```
       .cform label {
       	width:200px;
       	margin:0px 10px 0 0;
       	text-align:left;
       	font-size: 10px;
       	display:block;
       	color:#888888;
       	background:transparent;
       	padding:2px;
       }
       ```
   
 *  Thread Starter [pullman](https://wordpress.org/support/users/pullman/)
 * (@pullman)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367242)
 * Thanks for this. When i insert the condition, I get the following error:
 * `Parse error: syntax error, unexpected ':' in /home/philipu/public_html/wp-content/
   themes/f8-lite/header.php on line 43`
 * And when i remove the : I get:
 * `Parse error: syntax error, unexpected T_ECHO in /home/philipu/public_html/wp-
   content/themes/f8-lite/header.php on line 44`
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367244)
 * my bad – typo:
    should read `is_page('contact')`
 *     ```
       <?php
       if(is_page('contact')) :
       echo '<style type="text/css" media="screen">
       .container-inner {
       background:#FFF url('.get_bloginfo('template_url').'/images/contact_bg.jpg) left top no-repeat; }
       </style>';
       endif;
       ?>
       ```
   
 *  Thread Starter [pullman](https://wordpress.org/support/users/pullman/)
 * (@pullman)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367246)
 * You’re a wizard – thank you!
 * Just so I understand: that condition sort of “separated out” the contact page
   for the purposes of the background within the container-inner?
 * Thanks once again
    /p
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367259)
 * useful read:
    [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 *  Thread Starter [pullman](https://wordpress.org/support/users/pullman/)
 * (@pullman)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367410)
 * Thanks very much!
    p

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

The topic ‘Trouble adding background image’ is closed to new replies.

 * 8 replies
 * 2 participants
 * Last reply from: [pullman](https://wordpress.org/support/users/pullman/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/adding-background-image-trouble/#post-1367410)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
