参考 center()

center()

Centers the element either vertically, horizontally, or both.

center() will center the element relative to its parent or according to the page's body if the element has no parent.

If no argument is passed, as in myElement.center() the element is aligned both vertically and horizontally.

示例

语法

center([align])

参数

align
String:

passing 'vertical', 'horizontal' aligns element accordingly

Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!

相关参考