File: row_span.md

package info (click to toggle)
textual 2.1.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,080 kB
  • sloc: python: 85,423; lisp: 1,669; makefile: 101
file content (55 lines) | stat: -rw-r--r-- 1,303 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
# Row-span

The `row-span` style specifies how many rows a widget will span in a grid layout.

!!! note

    This style only affects widgets that are direct children of a widget with `layout: grid`.

## Syntax

--8<-- "docs/snippets/syntax_block_start.md"
row-span: <a href="../../../css_types/integer">&lt;integer&gt;</a>;
--8<-- "docs/snippets/syntax_block_end.md"

The `row-span` style accepts a single non-negative [`<integer>`](../../css_types/integer.md) that quantifies how many rows the given widget spans.

## Example

The example below shows a 4 by 4 grid where many placeholders span over several rows.

Notice that grid cells are filled from left to right, top to bottom.
After placing the placeholders `#p1`, `#p2`, `#p3`, and `#p4`, the next available cell is in the second row, fourth column, which is where the top of `#p5` is.

=== "Output"

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

=== "row_span.py"

    ```py
    --8<-- "docs/examples/styles/row_span.py"
    ```

=== "row_span.tcss"

    ```css hl_lines="2 5 8 11 14 17 20"
    --8<-- "docs/examples/styles/row_span.tcss"
    ```

## CSS

```css
row-span: 3
```

## Python

```py
widget.styles.row_span = 3
```

## See also

 - [`column-span`](./column_span.md) to specify how many columns a widget spans.