How do I add a background image to my Big Cartel theme?
Filed in Layout and styles
1. Upload Background Image
As of Core Release 7, you can upload your background image via your basic “Customize” options as detailed in section 2.d. Upload a Background Image of support article How do I use the basic "Customize" options for my Big Cartel theme?
Alternatively you can upload your background image to the web and obtain the public URL for its location, as detailed in the support article How do I upload images or files for my Big Cartel page content?.
2. Add Background CSS Code
If you uploaded your image using your basic “Customize” Big Cartel admin controls:
- Locate your CSS edit controls and scroll to the BACKGROUND IMAGE section as detailed in the support article How do I locate and use my theme's CSS?
- Locate the existing background CSS code and edit it as detailed below (DO NOT edit the W variable, as this will already contain code to assign your image automatically)
If you uploaded your image to an external hosting space (e.g. Dropbox, TinyPic, etc.):
- Navigate to your Big Cartel shop’s custom style coding area as detailed in the support article Where do I add custom style coding in my Big Cartel theme controls?
- Copy the following background CSS code into the custom style coding area and edit it as explained below
The background CSS code:
body {
background-image: url('W');
background-repeat: X;
background-position: Y;
background-attachment: Z;
background-size: N;
}
Note that we are styling the HTML element body which is the containing box for all of your shop content. In this example code, the values W, X, Y, Z and N should be set as follows:
| Variable | Description | Valid Values |
|---|---|---|
| W | The complete public URL obtained in step 1 above. Do not edit this if you uploaded your image using your basic “Customize” Big Cartel admin controls. | Example value: http://my-web-space.com/my-background-image.png |
| X | Defines how your background image tiles. | repeat Tiles the image both horizontally and vertically. repeat-x Tiles the image in the horizontal direction only. repeat-y Tiles the image in the vertical direction only. no-repeat No tiling. The background image is displayed once only. |
| Y | Defines the location of the background image, or the starting point for tiling if the image is repeated. | A B1 Where A is the horizontal alignment written as “left”, “center” or “right” and B is the vertical alignment written as “top”, “center” or “bottom”. For example, the value center top This will be the best setting for most layouts. |
| Z | Defines whether the background image scrolls with the page or remains fixed. | scroll The background image scrolls with the page. This will be the desired setting in most cases. fixed The background remains fixed, despite page scrolling. |
| N | Defines the size of the background image. This setting only works for browsers that support the latest web standards. | auto The background image is displayed at actual size. This will be the best setting for most layouts. contain Scales the background image so that the image’s largest dimension fills the page. cover Scales the background image so that the image’s smallest dimension fills the page, i.e. all of the page is filled. When applying ‘cover’, always set Z to ‘fixed’. A B Sets pixel or percentage values for the background image width and height respectively, e.g. 200px 150px, 50% 10% or 300px 100%. |
1. You can also specify A as a pixel or percentage value from the left of the browser window and B as a pixel or percentage value from the top of the browser window, e.g. 10px 50px or 50% 10%.
Click the Save link once you have finished editing your custom style coding area.
Based upon the above instructions, following is an example of code to be used if we wanted the background image to appear only once (i.e. no tiling), be positioned in the very center of the page and remain fixed:
body {
background-image: url('http://my-web-space.com/my-background-image.png');
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-size: auto;
}
Following is another example of code to have the background image tile horizontally across the very top of our page:
body {
background-image: url('http://my-web-space.com/my-background-image.png');
background-repeat: repeat-x;
background-position: center top;
background-attachment: scroll;
background-size: auto;
}
Following is another example of code to have the background image fill the entire page (note that we must set background-attachment to fixed in this case, as noted in the variable table above):
body {
background-image: url('http://my-web-space.com/my-background-image.png');
background-repeat: no-repeat;
background-position: center top;
background-attachment: fixed;
background-size: cover;
}
3. Content Area Background
The content area background colour, set by the Page Background colour group, will appear over the top of your background image. In some cases you may wish to remove this colour, so that your background image can be seen behind your entire page, including products and page content. In this case you can set the product area to be transparent.
Locate the Page Background colour group in your COLOUR CSS section, as detailed in the support article How do I edit my Big Cartel theme colours?, and set the colour to transparent. For example:
/* - - - - Page Background */
{% assign page_background = 'transparent' %}
Click the Save link at the top of the customisation area after you have finished editing your custom styles.
Related articles...
- How do I install and uninstall an alternate style block?Layout, Colours & Fonts
- What are the Extra Styles for my Aarcade Big Cartel theme?Layout, Colours & Fonts
- Why does my theme change on mobile devices and how do I stop if from doing so?Layout, Colours & Fonts
- Where do I add custom style coding in my Big Cartel theme controls?Layout, Colours & Fonts