html 图片不居中? 样式问题原因 样式 <template> <img src="./aserts/fengj2.png"> </template> <script setup> </script> <style> img { margin: 0 auto; } </style> 图片没有页面居中 问题原因 这是因为img标签是行级标签,并没有外边距,所以要设置display:block,这样图片就可以居中显示了。