Button and Input's height couldn't be set to 1 cell #2734
-
I set the Button and Input to '1 line' height in css, but the text on the button can't show out, and the height of button seems to be 2 line, while the Input keeps 3 line height. my python code is here: from textual.app import App, ComposeResult
from textual.widgets import TextLog
from textual.widgets import Button, Footer, Header, Static, Input, Label
class ControlZone(Static):
def compose(self) -> ComposeResult:
yield Button(label="prev", id="prev", variant="success")
yield Input("0", id="curNo")
class TextLogApp(App):
CSS_PATH = "test.css"
BINDINGS = [("d", "toggle_dark", "Toggle dark mode")]
def compose(self) -> ComposeResult:
yield Header()
yield Footer()
yield ControlZone()
yield TextLog(highlight=True, markup=True, wrap=False)
if __name__ == "__main__":
app = TextLogApp()
app.run() and the css code is here: ControlZone {
layout: horizontal;
margin: 0;
padding: 0;
}
Button {
content-align: center middle;
width: 5;
height: 1;
margin: 0;
padding: 0;
}
Input {
content-align: center middle;
width: 5;
height: 1;
margin: 0;
padding: 0;
} the app screenshot is here: when i change the height to 3, the app shows normal like this: i read the documents and refer to the #1377 , but i failed to solve my problem after trying set the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Note this part in the documentation for
If I add |
Beta Was this translation helpful? Give feedback.
Note this part in the documentation for
Button
:If I add
border: none;
to theButton
styles in your code it appears to work as you wish.