mudflap
mudflap

Reputation: 151

How do I assign negative positioning in percentage for elements in css?

I have a panel which has top:-138px; I want to give this in %, i tried giving negative percentage but it doesn't seem to be working.

Upvotes: 4

Views: 6336

Answers (1)

Matt Howell
Matt Howell

Reputation: 15936

You can do this as long as its parent element has a defined height, whether in pixels or percentage. If you play around with this fiddle, you'll notice that the inner element's top attribute is only respected if you give the container an explicitly-definied height.

http://jsfiddle.net/KcWSr/

Upvotes: 2

Related Questions