Link to home
Start Free TrialLog in
Avatar of Kay-Kay Clapp
Kay-Kay ClappFlag 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/
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

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.
Avatar of 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?
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?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial