<!--
{
  "documentType" : "article",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/contents-gravity-values",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Contents Gravity Values"
}
-->

# Contents Gravity Values

The contents gravity constants specify the position of the content object when the layer bounds is larger than the bounds of the content object. They are used by the [`contentsGravity`](/documentation/QuartzCore/CALayer/contentsGravity) property.

## Topics

### Constants

[`center`](/documentation/QuartzCore/CALayerContentsGravity/center)

The content is horizontally and vertically centered in the bounds rectangle.

[`top`](/documentation/QuartzCore/CALayerContentsGravity/top)

The content is horizontally centered at the top-edge of the bounds rectangle.

[`bottom`](/documentation/QuartzCore/CALayerContentsGravity/bottom)

The content is horizontally centered at the bottom-edge of the bounds rectangle.

[`left`](/documentation/QuartzCore/CALayerContentsGravity/left)

The content is vertically centered at the left-edge of the bounds rectangle.

[`right`](/documentation/QuartzCore/CALayerContentsGravity/right)

The content is vertically centered at the right-edge of the bounds rectangle.

[`topLeft`](/documentation/QuartzCore/CALayerContentsGravity/topLeft)

The content is positioned in the top-left corner of the bounds rectangle.

[`topRight`](/documentation/QuartzCore/CALayerContentsGravity/topRight)

The content is positioned in the top-right corner of the bounds rectangle.

[`bottomLeft`](/documentation/QuartzCore/CALayerContentsGravity/bottomLeft)

The content is positioned in the bottom-left corner of the bounds rectangle.

[`bottomRight`](/documentation/QuartzCore/CALayerContentsGravity/bottomRight)

The content is positioned in the bottom-right corner of the bounds rectangle.

[`resize`](/documentation/QuartzCore/CALayerContentsGravity/resize)

The content is resized to fit the entire bounds rectangle.

[`resizeAspect`](/documentation/QuartzCore/CALayerContentsGravity/resizeAspect)

The content is resized to fit the bounds rectangle, preserving the aspect of the content. If the content does not completely fill the bounds rectangle, the content is centered in the partial axis.

[`resizeAspectFill`](/documentation/QuartzCore/CALayerContentsGravity/resizeAspectFill)

The content is resized to completely fill the bounds rectangle, while still preserving the aspect of the content. The content is centered in the axis it exceeds.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)