mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add example with all margin rules.
This commit is contained in:
54
docs/examples/styles/margin_all.css
Normal file
54
docs/examples/styles/margin_all.css
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
Screen {
|
||||||
|
background: $background;
|
||||||
|
}
|
||||||
|
|
||||||
|
Grid {
|
||||||
|
grid-size: 4;
|
||||||
|
grid-gutter: 1 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Placeholder {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
Container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bordered {
|
||||||
|
border: white round;
|
||||||
|
}
|
||||||
|
|
||||||
|
#p1 {
|
||||||
|
/* default is no margin */
|
||||||
|
}
|
||||||
|
|
||||||
|
#p2 {
|
||||||
|
margin: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#p3 {
|
||||||
|
margin: 1 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
#p4 {
|
||||||
|
margin: 1 1 2 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
#p5 {
|
||||||
|
margin-top: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#p6 {
|
||||||
|
margin-right: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#p7 {
|
||||||
|
margin-bottom: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#p8 {
|
||||||
|
margin-left: 3;
|
||||||
|
}
|
||||||
20
docs/examples/styles/margin_all.py
Normal file
20
docs/examples/styles/margin_all.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
from textual.app import App
|
||||||
|
from textual.containers import Container, Grid
|
||||||
|
from textual.widgets import Placeholder
|
||||||
|
|
||||||
|
|
||||||
|
class MarginAllApp(App):
|
||||||
|
def compose(self):
|
||||||
|
yield Grid(
|
||||||
|
Container(Placeholder("no margin", id="p1"), classes="bordered"),
|
||||||
|
Container(Placeholder("margin: 1", id="p2"), classes="bordered"),
|
||||||
|
Container(Placeholder("margin: 1 5", id="p3"), classes="bordered"),
|
||||||
|
Container(Placeholder("margin: 1 1 2 6", id="p4"), classes="bordered"),
|
||||||
|
Container(Placeholder("margin-top: 4", id="p5"), classes="bordered"),
|
||||||
|
Container(Placeholder("margin-right: 3", id="p6"), classes="bordered"),
|
||||||
|
Container(Placeholder("margin-bottom: 4", id="p7"), classes="bordered"),
|
||||||
|
Container(Placeholder("margin-left: 3", id="p8"), classes="bordered"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
app = MarginAllApp(css_path="margin_all.css")
|
||||||
Reference in New Issue
Block a user