英文:
How to add vertical and horizontal space from text to top of <textarea> without padding?
问题
通常情况下,您只需使用填充(padding)来实现这一点,但我有一些需要尺寸信息的 JavaScript 代码,这将需要我进行大量的像素精确调整,尤其是如果我计划多次使用该 JavaScript。
水平间距有一个 [text-indent][1]
属性,但它仅适用于第一行。
英文:
Normally you'd just use padding for this but I have some js that requires the dimensions and that would require me to do a lot of pixel-perfecting especially if I'm planning to use that js multiple times.
There's a [text-indent][1]
property for horizontal spacing but it only works for the first line
答案1
得分: 1
<Grid sx={{ display: 'flex', marginLeft:1,}}> <Typography>text here</Typography></Grid>
你也可以在CSS文件中这样做。
英文:
Assuming you have a Grid component for example, and inside is a Typography component then you could do this
<Grid sx={{ display: 'flex', marginLeft:1,}}> <Typography>text here</Typography></Grid>
You can as well do this in a css file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论