{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# CSS 变量\n", "\n", "您可以通过设置 CSS 变量来自定义 NiceGUI 的外观。目前,以下变量及其默认值可用:\n", "\n", "- `--nicegui-default-padding`: 1rem\n", "- `--nicegui-default-gap`: 1rem" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from nicegui import ui\n", "\n", "ui.add_style('''\n", " :root {\n", " --nicegui-default-padding: 0.5rem;\n", " --nicegui-default-gap: 3rem;\n", " }\n", "''')\n", "with ui.card():\n", " ui.label('small padding')\n", " ui.label('large gap')\n", "\n", "# ui.run()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "py311", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" } }, "nbformat": 4, "nbformat_minor": 2 }