viewbox

viewbox

The viewBox attribute allows you to specify that a given set of graphics stretch to fit a particular container element.

The value of the viewBox attribute is a list of four numbers min-x, min-y, width and height, separated by whitespace and/or a comma, which specify a rectangle in user space which should be mapped to the bounds of the viewport established by the given element, taking into account attribute preserveAspectRatio.

Negative values for width or height are not permitted and a value of zero disables rendering of the element.

Usage context

Categories None
Value See above
Animatable Yes
Normative document SVG 1.1 (2nd Edition)

Example

Elements

The following elements can use the viewBox attribute

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部