tags:

views:

26

answers:

2

I have 2 divs in an outer div. The outer div has a top margin so there is a space above it. I want to move the left inner div a little up to fill some of that space. I did a minus margin-top.. it works, it pushes the left inner div up.. but it hides the top 10px that moved up. I want them to stay visible.

I tried making the div have z-index to the front (1) but it does not work. I want to move the inner left div up and want the pushed up part to stay visible.

<div id="line"> //style margin-top:30px

  <div id="lineleft"> //style margin-top:-10 z-index=1
  </div>

  <div id="lineright">
  </div>

</div>
+1  A: 

Seems to be working here in all major browsers: http://jsfiddle.net/rBTtt/

Alec
+1  A: 

You may need to change the value of the overflow property on the outer div.

Yi Jiang
Just discovered that I need that overflow auto. without it the background of outer div collapses. ah, what to do? any ideas?
jblue
@jblue It's for the `float` s, right? You'll need a clearfix (search for this term) element - an element below the outer div with `clear: both` applied. Alternatively, if you already have an element below it, apply `clear: both` to that
Yi Jiang