开发者

align an html canvas to absolute top of the web page

I would l开发者_Python百科ike to know how to align a canvas element to the absolute top ( 0 , 0 ) of the web page.

I have tried: margin: 0; padding: 0px; but no good.

There's always some white space at the top.


Make sure your "body" and "html" have no padding:

body, html { padding: 0; margin: 0; }

Then make sure the canvas is either "naturally" positioned at the top, or else is absolutely positioned.


Consider using a reset.css when designing web pages, this will clear out any and all default styles that most browsers will inject as default. I like this one: http://yuilibrary.com/yui/docs/cssreset/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜