File size: 782 Bytes
5b76e0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Offset

The `offset` rule adds an offset to the widget's position. The offset is given as two values.

Coordinates may be specified individually with `offset-x` and `offset-y`.

## Syntax

```
offset: <SCALAR> <SCALAR>;
```

## Example

In this example, we have 3 widgets with differing offsets.

=== "offset.py"

    ```python
    --8<-- "docs/examples/styles/offset.py"
    ```

=== "offset.css"

    ```css
    --8<-- "docs/examples/styles/offset.css"
    ```

=== "Output"

    ```{.textual path="docs/examples/styles/offset.py"}
    ```

## CSS

```sass
/* Move the widget 2 cells in the x direction, and 4 in the y direction. */
offset: 2 4;
```

## Python

```python
# Move the widget 2 cells in the x direction, and 4 in the y direction.
widget.styles.offset = (2, 4)
```