How to assign negative positioning in percent for elements in css?

I have a panel that has a top: -138px; I want to give this in%, I tried to give a negative percentage, but it does not seem to work.

+3
source share
1 answer

You can do this as long as its parent has a certain height, whether in pixels or percent. If you play with this violin, you will notice that the attribute of the inner element topis respected only if you give the container explicitly defined height.

http://jsfiddle.net/KcWSr/

+2
source

All Articles