Skip to content

Height

The height style sets a widget's height.

Syntax

height: <scalar>;

The height style needs a <scalar> to determine the vertical length of the widget. By default, it sets the height of the content area, but if box-sizing is set to border-box it sets the height of the border area.

Examples

Basic usage

This examples creates a widget with a height of 50% of the screen.

HeightApp Widget

from textual.app import App
from textual.widget import Widget


class HeightApp(App):
    CSS_PATH = "height.tcss"

    def compose(self):
        yield Widget()