Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to somehow override a container's padding?

Tags:

html

css

padding

I could be way overthinking this but I'm working with Wordpress for the first time and getting used to everything is giving me a major headache.

Basically, I have a container div. I'm lazy and put a 10px padding. But for the theme I'm trying to create, I have a couple of divs that I want to span the entire container, without the padding.

Here's a picture example:

enter image description here

Is there a way to bypass the container div's settings so this one bar won't be padded?

like image 394
kristen q Avatar asked Nov 28 '22 22:11

kristen q


2 Answers

You can add negative margins on the divs that should span the entire container:

div { margin-right: -10px; margin-left: -10px; }
like image 170
chicagoing Avatar answered Dec 09 '22 19:12

chicagoing


Negative margins are your friend here.

.wide-child{
    margin: 0 -10px;
}

fiddle

like image 20
devstruck Avatar answered Dec 09 '22 17:12

devstruck