Quick reference

Class
Properties
object-bottomobject-position: bottom;
object-centerobject-position: center;
object-leftobject-position: left;
object-left-bottomobject-position: left bottom;
object-left-topobject-position: left top;
object-rightobject-position: right;
object-right-bottomobject-position: right bottom;
object-right-topobject-position: right top;
object-topobject-position: top;

Basic usage

Positioning a replaced element

Use the object-{side} utilities to specify how a replaced element’s content should be positioned within its container.

object-left-top

object-top

object-right-top

object-left

object-center

object-right

object-left-bottom

object-bottom

object-right-bottom

<img class="object-none object-left-top bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-top bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-right-top bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-left bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-center bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-right bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-left-bottom bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-bottom bg-yellow-300 w-24 h-24 ..." src="...">
<img class="object-none object-right-bottom bg-yellow-300 w-24 h-24 ..." src="...">

Applying conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:object-top to only apply the object-top utility on hover.

<img class="object-center hover:object-top" src="...">

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:object-top to apply the object-top utility at only medium screen sizes and above.

<img class="object-center md:object-top" src="...">

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.


Using custom values

Customizing your theme

By default, Tailwind provides nine object position utilities. You can customize these values by editing theme.objectPosition or theme.extend.objectPosition in your tailwind.config.js file.

tailwind.config.js
module.exports = {
  theme: {
    extend: {
      objectPosition: {
        'center-bottom': 'center bottom',
      }
    },
  }
}

Learn more about customizing the default theme in the theme customization documentation.

Arbitrary values

If you need to use a one-off object-position value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

<img class="object-[center_bottom]" src="...">

Learn more about arbitrary value support in the arbitrary values documentation.