美文网首页Android 开发工具
开发过程中遇到问题

开发过程中遇到问题

作者: galafan | 来源:发表于2020-03-24 17:35 被阅读0次
    View中子元素的位置

    如使用flex布局时justify-content失效原因:
    1.子级中使用了margin:auto;属性会导致其失效。
    2.如果使用在子view中使用 margin-right: 20rpx;也会导致justify-content失效

    .parents_layout {
      height: 100rpx;
      display: flex;
      flex-direction: row;
      justify-content: flex-end;
      align-items: center;
    }
    .child-view {
      background-color: #c7cac5;
      color: white;
      height: 70rpx;
      font-size: 26rpx;
      margin: 0 20rpx;
    
    }
    <-- 如果使用在子view中使用  margin-right: 20rpx;也会导致justify-content失效!-->
    
    
    view居中居下显示

    之前在写微信小程序的时候想让view居右显示,采用css的float,可是无效,后来发现只需简单的加上
    position: fixed;就可以用left:;right:;top:;bottom:;来固定位置了,当然它还有一个效果就是悬浮固定,如果固定了X轴Y轴的位置,就不会再跟随界面移动。

    .recommend-bottom {
      position: fixed;
      bottom: 10rpx;
    }
    

    相关文章

      网友评论

        本文标题:开发过程中遇到问题

        本文链接:https://www.haomeiwen.com/subject/qlidyhtx.html