小程序scroll-view简单使用,子元素换行在ios中出现子元素不换行问题,没有顶部对齐的问题;去除滚动条样式;子元素文字不换行

本文介绍了在小程序中使用scroll-view遇到的问题,包括子元素在iOS上不换行、顶部对齐问题以及滚动条样式去除等。通过调整CSS属性如vertical-align、white-space和display,可以解决这些问题。对于高度不一致的子元素,使用vertical-align: top使其顶部对齐。在使用white-space: nowrap时,可能会在iOS上导致错位,可通过添加浮动或额外层来修复。
摘要由CSDN通过智能技术生成

1.代码

1.1.wxml

<!-- 图片,横向scroll-x必须设置为true -->
<scroll-view class='parentone' scroll-x="{
  {true}}">
  <view class='sonone' style='background-color:red;'></view>
  <view class='sonone' style='background-color:blue;'></view>
  <view class='sonone' style='background-color:orange;'></view>
  <view class='sonone' style='background-color:green;'></view>
  <view class='sonone'></view>
</scroll-view>

<!-- 图片,横向scroll-x必须设置为true -->
<scroll-view class='parentwo' scroll-x="{
  {true}}">
  <view class='sontwo' style='background-color:red;'></view>
  <view class='sontwo' style='background-color:blue;'></view>
  <view class='sontwo' style='background-color:orange;'></view>
  <view class='sontwo' style='background-color:green;'></view>
  <view class='sontwo'></view>
</scroll-view>

<!-- 图片,纵向拖动scroll-y="true"必须设置为true -->
<scroll-view class='parenthree' scroll-y="{
  {true}}">
  <view class='sonthree' style='background-color:re
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值