Why is there a gap between WeChat Mini Programs view tag and text tag?

<view style="height:24rpx;">
  <text style="font-size:24rpx;line-height:24rpx;">aaa</text>
</view>

in this way, in the simulator, the positions of the view tag and the text tag are staggered. There is a distance between the top of the text and the top of the view, and the text is not aligned with the upper left of the view. What is the reason and how to solve it?
(I tried to convert the text in the view tag into a block element, and the height of the view is highly consistent with that of the text. Some key layouts need to have several inline elements in the view on one line, such as an image image aligned with a paragraph of text, and cannot be turned into blocks. )

Try setting font-size to 0 in

view


layout. If there is too much inline-block, you might as well change to block, and float


you deserve to have ~

with display:flex,.
Menu