tags:

views:

21

answers:

2

I have a parent div and a child div. The parent div has a border-width property, but unfortunately that border-width is blocking part of the child div from being shown. The border-width property of the parent div cannot be changed. How can I get the child div to show up above the parent div's border?

Should note that the parent div has position: absolute applied, the child div does not have position applied in the CSS, and only the left and right edges of the child div are not shown, since only the border-left and border-right of the parent div are set.

A: 

Hi,

Try using the margin-top attribute with a negative value.

for example

childDivId

{ margin-top: -50px; }

This will raise you child div higher on the screen.

Be happy

Julian
Sorry, I meant above in the sense that the child div would display above the borders, as in the child div is closer to you than the border. I tried z-index and it didn't work, which is the obvious answer if you want one element to be "closer" to you.
George
A: 

See example: http://jsfiddle.net/LGR8w/

Once the elements are positioned, you are able to make the child div overlap the parent's border instead of simply expanding the parent to fit the content. (though why you want to do that is beyond me).

EDIT:

If I'm wrong, could you please explain to me why you want to make the child and parent content overlap rather than simply making the parent expand to properly fit the child? Unless this is for a stylistic overlapping design, I don't see why this is necessary.

Moses
The parent div must stay at its current size. It cannot expand.
George
If it cannot expand in height, then the child element has to be taken out of the flow of the document so it can overlap the parent document. Use position:absolute for the child, and adjust it w/ left right top or bottom.
Moses
That's what I was thinking of doing. It's looking like it will just be much easier to position: absolute the child. Thanks for the help.
George