CCHert
CCHert

Reputation: 35

Expanding Div to Ful Width

I know there are numerous threads on this subject but I couldn't get any of the suggestions I found to work for me. Whether that's due to novice status or because the code wasn't suitable, I don't know. But I'm now pulling my hair our after trying to get the grey background behind the h2 tag "Attachments" and the two lines that follow it to expand to full width, removing the white spaces that are currently to the left and right of this div.

http://bit.ly/1OVprsc

Upvotes: 3

Views: 44

Answers (2)

izorgor
izorgor

Reputation: 138

Your grey div is inside g-container div which have width that is not full one. So if you want to have that grey div full width u must change your structure into something like this:

<div class="g-container">
CONTENT
</div>
<div class="grey-div"></div>
<div class="g-container">
CONTENT
</div>

Or you can do it with position absolute but then none of the parent of the grey div shouldn`t be position relative so the grey div can be absolute relative to body.

Upvotes: 0

IndieTech Solutions
IndieTech Solutions

Reputation: 2541

One approach is to use negative margins and padding to extend the background in both directions.

margin: 0 -9999rem;
padding: 0.25rem 9999rem;

Upvotes: 2

Related Questions