We help IT Professionals succeed at work.

CSS - full width section background in wordpress

Last Modified: 2014-05-20

I'm trying to extend a content section's background image to be full width across the page. How can this be achieved with CSS?

I'm using Visual Composer plugin on a Wordpress site. (sorry I know. I'm just terrible at div structuring and CSS, suggestions to create this without Visual Composer are welcome)

Thank you in advance.

URL: http://independentraceshop.com/
Watch Question

Top Expert 2004

Which section?  I took a look at the site, but nothing really jumped out at me.

In general terms, you can give a div position:absolute with specific placement and a lower z-index.  That approach has some obstacles if it is further down in your structure, though.


Sorry. The section below the slider image with the darker background image with the text Independent Race Shop and Services.

Can you elaborate further what the lower z-index accomplishes?
Top Expert 2004

Which element, specifically, are you trying to target?  None of those containing elements have a background-image set.

When you use position:absolute, browsers will automatically place the element in front of elements still in the normal flow.  You can alter this by adjusting z-index to move it behind your normal flow content.  

The obstacles that come with having it in the middle of the page structure are because position:absolute elements will use the nearest position:absolute or position:relative ancestor as their context frame.  If you have no such ancestors, then <body> becomes the context frame, and you'll have to set the top/left attributes to compensate.  Using a position:relative as a containing element can cause issues with other floats.  The exact approach really depends on the final look you would like to achieve.


Thank you Steve this helps clarify the structure which is really helpful! Currently I removed the background image. Do you have any blog posts you can recommend that walk through an example of what you've just described?
Top Expert 2004
This one is on us!
(Get your first solution completely free - no credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.