.vue 页面遇到如下问题:
view 下使用 image 标签发现多出来一个边距,审查元素发现有个 body 选择器中默认有个 font-size : 16px,修改为 0 边距就不见了,或者在 image 的 父标签 view 添加 font-size: 0 ,边距就会消失。能否有人解答一下这是怎么回事。
<template>
<view class="test">
<image src="../../static/c.jpg" mode=""></image>
<image src="../../static/c.jpg" mode=""></image>
<image src="../../static/c.jpg" mode=""></image>
</view>
</template>
<script>
export default {
data() {
return {
categoryData: [
{
id: 1,
categoryName: '风景',
categoryImgPath: '/static/c.jpg',
categoryPage: ''
},
{
id: 2,
categoryName: '军事',
categoryImgPath: '/static/c.jpg',
categoryPage: ''
},
{
id: 2,
categoryName: '幼崽',
categoryImgPath: '/static/c.jpg',
categoryPage: ''
}
]
}
},
onLoad() {
},
methods: {
}
}
</script>
<style lang="scss">
// .test { // 如果把这个加上就不会有边距
// font-size: 0;
// }
</style>
4***@qq.com (作者)
这就能理解了为什么多出来一个缝隙,感谢!
2022-04-24 09:54
3***@qq.com
长知识了大哥
2024-05-16 10:47