HTML基本知识


text

单行文本溢出隐藏

一行文字太长,用省略号隐藏

 .content {
    width: 300px;
    border: 1px solid red;
    /* 强制不换行 */
    white-space: nowrap;
    /* 文字用省略号代替超出的部分 */
    text-overflow: ellipsis;
    /* 匀速溢出内容,隐藏 */
    overflow: hidden;   
  }

组件/常用操作

多个div超出宽度,水平滑动

最外层:overflow: hidden;white-space: nowrap;overflow-x:auto;

里面的多个div:display: inline-block;

 <!-- tags -->
<view
class="tags"
style="margin-left: 10rpx;overflow: hidden;white-space: nowrap;overflow-x:auto;"
>
<van-tag
    wx:for="{{ question.tags }}"
    bindtap='onTapTag'
    data-content='{{item}}'
    type="primary"
    size="large"
    color="#f6f6f6"
    text-color="#808080"
    wx:key="index"
    style="margin-left: 10rpx; display: inline-block;"
>{{
    item
}}</van-tag>
</view>
posted @ 2022-04-22 22:45  ticlab  阅读(33)  评论(0编辑  收藏  举报