mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
73 lines
1.1 KiB
Markdown
73 lines
1.1 KiB
Markdown
---
|
|
extends: _layouts.markdown
|
|
title: "Position"
|
|
---
|
|
|
|
# Position
|
|
|
|
The position utilities are primarily `position` property helpers.
|
|
|
|
```html
|
|
<!-- Using the utilities in HTML: -->
|
|
|
|
<div class="fixed"></div>
|
|
<div class="absolute"></div>
|
|
<div class="relative"></div>
|
|
```
|
|
|
|
```less
|
|
// 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.
|
|
|
|
```html
|
|
<!-- Using the utilities in HTML: -->
|
|
|
|
<div class="relative">
|
|
<div class="absolute pin-t"></div>
|
|
</div>
|
|
```
|
|
|
|
```less
|
|
// 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 <a href="/responsive">responsive</a> prefixes:
|
|
|
|
```html
|
|
<!-- Using the utilities in HTML: -->
|
|
|
|
<div class="fixed sm:absolute md:relative"></div>
|
|
```
|
|
|
|
```less
|
|
// Using the utilities in Less:
|
|
|
|
div {
|
|
.screen(md, {
|
|
.relative;
|
|
});
|
|
}
|
|
```
|