tailwindcss/docs/source/position.md
2017-08-03 13:24:05 -04:00

1.2 KiB

extends title
_layouts.master Position

Position

The position utilities are primarily position property helpers.

<!-- Using the utilities in HTML: -->

<div class="fixed"></div>
<div class="absolute"></div>
<div class="relative"></div>
// Using the utilities in Less:

div {
  .fixed;
  .absolute;
  .relative;
}

Pinning absolute content

Tailwind also provides pin utilties, useful for "pinning" absolutely positioned elements using the top, right, bottom and left properties.

<!-- Using the utilities in HTML: -->

<div class="relative">
    <div class="absolute pin-t"></div>
</div>
// Using the utilities in Less:

div {
  .pin;
  .pin-t;
  .pin-r;
  .pin-b;
  .pin-l;
  .pin-x;
  .pin-y;
}

Responsive

The position utitlies can also be used with responsive prefixes:

<!-- Using the utilities in HTML: -->

<div class="fixed sm:absolute md:relative"></div>
// Using the utilities in Less:

div {
  .screen(md, {
    .relative;
  });
}