mozilla
您的搜索结果

    <canvas> 标签

    这篇翻译不完整。请帮忙从英语翻译这篇文章

    Summary

    HTML <帆布>元素可以用来绘制图形通过脚本(通常JavaScript)。例如,它可以被用来绘制图形,使摄影作品,甚至执行动画。你可以(也应该)在<帆布>块提供替代内容。内容就会呈现在旧的浏览器不支持画布和浏览器禁用了JavaScript。

    For more articles on canvas, see the canvas topic page.

    Attributes

    This element includes the global attributes.

    width
    The width of the coordinate space in CSS pixels. Defaults to 300.
    height
    The height of the coordinate space in CSS pixels. Defaults to 150.

    Note: The displayed size of the canvas can be changed using a stylesheet. The image is scaled during rendering to fit the styled size.

    Examples

    <canvas id="canvas" width="300" height="300">
      Sorry, your browser doesn't support the &lt;canvas&gt; element.
    </canvas>
    

    Specifications

    Specification Status Comment
    WHATWG HTML Living Standard
    <canvas>
    Living Standard  
    HTML5
    <canvas>
    Recommendation  

    Browser compatibility

    Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
    Basic support 1.5 (1.8) 1.0 9.0 9.0 2.0
    Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
    Basic support 1.0 (1.8) ? ? ? 1.0

    Browser-specific notes

    Firefox (Gecko)

    • Before Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2), the canvas width and height were signed integers instead of unsigned integers.
    • Prior to Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3), a <canvas> element with a zero width or height would be rendered as if it had default dimensions.
    • Before Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9), if JavaScript is disabled, the <canvas> element was being rendered instead of showing the fallback content as per the specification. Now the fallback content is rendered instead.

    See also

    HTML元素
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
    (快速链接 HTML Category)

    文档标签和贡献者

    Contributors to this page: xcffl, ziyunfei, qguor, lunix01
    最后编辑者: lunix01,