开发者

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

开发者 https://www.devze.com 2023-02-17 11:14 出处:网络
I have a panel which has top:-138px; I want to give this in %, i tried givin开发者_开发问答g negative percentage but it doesn\'t seem to be working.You can do this as long as its parent element has a

I have a panel which has top:-138px; I want to give this in %, i tried givin开发者_开发问答g negative percentage but it doesn't seem to be working.


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号