html页面未超出范围却出现滚动条,解决方法

简介

在这里插入图片描述

解决办法

<template>
	<view class="content">
		<view class="top"></view>
	</view>
</template>

<script>
	export default {
      
      
		data() {
      
      
			return {
      
      
				
			}
		},
		onLoad() {
      
      
	
		},
		methods: {
      
      }
	}
</script>

<style lang="scss">
 //解决方式
.content{
      
      
	overflow:auto;
	//或者
	padding-top:0.1px;
}
.top{
      
      
	//元素设置上外边距,导致整体出现滚动条
	width:100%;
	height:30px;
	background-color:red;
	margin-top:30px;
}
</style>

猜你喜欢

转载自blog.csdn.net/xulihua_75/article/details/127085880