Avatar of Kay-Kay Clapp
Kay-Kay Clapp
Flag for United States of America asked on

CSS - full width section background in wordpress

Hello,

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/
WordPressWeb DevelopmentCSS

Avatar of undefined
Last Comment
Steve Bink

8/22/2022 - Mon
Steve Bink

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.
Kay-Kay Clapp

ASKER
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?
Steve Bink

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Kay-Kay Clapp

ASKER
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?
ASKER CERTIFIED SOLUTION
Steve Bink

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question