• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Add Background Image To Widget Area Using CSS

This CSS enables you to add a background image to any widget area in any theme.

In this case the image has been uploaded to the WordPress Media Library however, you can also upload the image file to your child themes images folder and use this method :

.front-page-2 {
    background-image: url('https://wpsites.net/wp-content/uploads/2018/10/hero.jpg');
    background-color: #cccccc; 
    height: 500px; 
    background-position: center;
    background-repeat: no-repeat; 
    background-size: contain;
}

Assumes your main widget area class is front-page-2 otherwise swap that out to match your widgets container class.

CSS Installation #

Swap out the URL to your background image in the above CCS rule and paste at the end of your child themes functions file. Clear caching.

You can also upload a image to your child themes images folder and use this CSS declaration in replace of the full image link :

background-image: url('images/hero.jpg');

Use the following declaration to make the image cover the entire widget container :

background-size: cover;

To do this, change the value for the background-image from contain to cover.

Other Methods

  • Add a background image behind a widget area using inline CSS
  • Add Images To Front Page Widget Backgrounds

Background Image

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems