Mini Program's text component, how to remove the default upper and inner margins?

Mini Program text component, there will be a default similar to the upper margin, but can not be dealt with with padding, this is Mini Program based on what consideration to increase this margin, is there any way to remove it?

clipboard.png

clipboard.png

Mar.03,2021

because you cannot wrap a line,
< text >
{{item.title}}
< / text >
, the blank area appears.
has to write in this way < text > {{item.title}} < / text >


. At first I wrote < view > {item.title}} < / view > and found the text on the left on the real machine after the line break. The text on the left side of the real machine is aligned, but in your case, there is a blank on it, it seems that padding-top, can not be removed. Later, I wrote < view > < / view > < text > {{item.title}} < / text >, two by one, damn it, magic, the two problems were solved together, text alignment, and the blanks above were removed


I also encountered the same problem. Come to think of it, the picture will also occupy a few pixels at the top in web development, because it is an inline element, so you only need to set the image to display:block (block-level element). The same should be used in Mini Program's < text style='diaplay:block' >.


if you want to center, you can use the same value as padding


you can set line-height equal to hieght, to make him center vertically.


display:block does not eliminate the upper margin. I used margin-top:-20px.


is the problem of line break. Newline characters and spaces are identified in the text tag. So you can't write
< text >

{{item.title}}

< / text >

this will identify two lines, and the top line has no content, so it looks like there will be an upper margin

< text > {{item.title}} < / text >

.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b363c0-2c014.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b363c0-2c014.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?