thatOneGuy
thatOneGuy

Reputation: 10642

Place div directly above parent div

Fiddle : http://jsfiddle.net/reko91/S2Kaw/454/

Notice that the child div is slightly offset. Ive found answers where you can add top to the css like so :

top:-20px;

But I don't want to set this myself. What is the best way so it doesn't have any margin/padding etc. I have tried :

margin:0px;
padding:0px;

But no luck

Upvotes: 0

Views: 56

Answers (2)

Satej S
Satej S

Reputation: 2156

What you essentially need to do is give padding:0px to your container-div.

Upvotes: 2

Marcos Pérez Gude
Marcos Pérez Gude

Reputation: 22158

Set padding top to zero in .container-div

http://jsfiddle.net/S2Kaw/455/

.container-div {
  padding: 0px 10px 0;
  background-color:#c3c3c3;
  width:200px;
}

Upvotes: 5

Related Questions