2018-02-13 03:50:31 -08:00
|
|
|
---
|
2018-02-19 02:55:30 -08:00
|
|
|
path: "/docs/width-height"
|
2018-02-13 03:50:31 -08:00
|
|
|
title: "Width and Height"
|
|
|
|
hasPlayground: true
|
|
|
|
---
|
|
|
|
|
2018-02-14 07:53:07 -08:00
|
|
|
## Width and Height
|
|
|
|
|
2018-02-16 06:41:54 -08:00
|
|
|
The `width` property in Yoga specifies the width of the element's content area.
|
|
|
|
Similarly `height` property specifies the height of the element's content area.
|
2018-02-14 07:53:07 -08:00
|
|
|
|
2018-02-16 06:41:54 -08:00
|
|
|
Both `width` and `height` can take following values:
|
2018-02-15 06:12:12 -08:00
|
|
|
|
2018-02-16 06:41:54 -08:00
|
|
|
**AUTO** Is the default Value, Yoga calculates the width/height for the element based
|
|
|
|
on its content, whether that is other children, text, or an image.
|
2022-10-04 13:59:32 -07:00
|
|
|
|
2018-02-16 06:41:54 -08:00
|
|
|
**PIXELS** Defines the width/height in absolute pixels. Depending on other properties set on
|
|
|
|
the Yoga node this may or may not be the final dimension of the node.
|
2018-02-15 06:12:12 -08:00
|
|
|
|
2018-02-16 06:41:54 -08:00
|
|
|
**PERCENTAGE** Defines the width or height in percentage of its parent's width or height respectively.
|
2018-02-15 06:12:12 -08:00
|
|
|
|
|
|
|
### Width
|
2018-02-14 07:53:07 -08:00
|
|
|
<controls prop="width"></controls>
|
|
|
|
|
2018-02-15 06:12:12 -08:00
|
|
|
### Height
|
2018-02-14 07:53:07 -08:00
|
|
|
<controls prop="height"></controls>
|